No commit activity in last 3 years
No release in over 3 years
SimpleEnum::Scopes is extension of SimpleEnum, which brings scopes to ActiveRecord enum attributes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 4.0.0
~> 10.0
~> 2.14

Runtime

 Project Readme

SimpleEnum::Scopes

SimpleEnum::Scopes is extension of SimpleEnum, which brings scopes to ActiveRecord enum attributes.

It'll avoid to write a bunch of scopes doing basically the same job.

Usage

class Object
    as_enum :state, [:very_bad, :bad, :good, :very_good]
end


Object.states_as(:bad, :very_good)
# Object.where(state_cd: [Object.states[:bad], Object.states[:very_good]])


Object.state_between(:bad, :very_good)
# Object.where(state_cd: Object.states[:bad]..Object.states[:very_good])

License

The gem is available as open source under the terms of the MIT License.