Module: Katsudo::Scopes
- Included in:
- Models::Activity::ClassMethods
- Defined in:
- lib/katsudo/models/scopes.rb
Instance Method Summary collapse
Instance Method Details
#fetch(*args) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/katsudo/models/scopes.rb', line 4 def fetch(*args) = args. conditions = {} if args.first conditions[:type] = args.first.to_s.classify end if [:resource] conditions[:resource_type] = [:resource].class.name conditions[:resource_id] = [:resource].id end if [:user] conditions[:user_type] = [:user].class.name conditions[:user_id] = [:user].id end where(conditions) end |