No release in over 3 years
Low commit activity in last 3 years
Determine if an activerecord instance is within a named scope.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

> 3.2.0
 Project Readme

Within Named Scope

A simple gem for drying up checking if an ActiveRecord instance is within a named scope.

Support for Rails 3.2+ and 4.0+

Usage

Using the 'in_scope?' method:

class Post < ActiveRecord::Base
  scope :published, -> { where(published: true)}
end

Post.first.in_scope? :published

Adding a named method:

class Post < ActiveRecord::Base
  scope :published, -> { where(published: true)}
  
  # Would default to published?
  scope_membership :published, as: :is_published?
end

Post.first.is_published?

Authors

  • Cory ODaniel