This gem will generate defaults scopes based on ActiveRecord's model and it's attributes types.
class Actor < ActiveRecord::Base
include CommonScopes
end
actors = Actor.
by_created_at_greater('2017-01-01').
by_name_start('Jeremy').
by_age_greater(30).
by_age_lesser(40)
Add this line to your application's Gemfile:
gem 'common_scopes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install common_scopes
Any help would be appreciated ! Simple for and make a PR with your code !
The gem is available as open source under the terms of the MIT License.