Module: Autoscope::ActiveRecordMethods::ClassMethods
- Defined in:
- lib/autoscope/active_record_methods.rb
Instance Method Summary collapse
-
#add_scopes(params, scope = self.all) ⇒ ActiveRecord::Relation
adds any available scopes to the scope passed in.
-
#scope_definition ⇒ Hash
Scope definition.
Instance Method Details
#add_scopes(params, scope = self.all) ⇒ ActiveRecord::Relation
adds any available scopes to the scope passed in
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/autoscope/active_record_methods.rb', line 38 def add_scopes(params, scope = self.all) params = params.with_indifferent_access # add any type parameters scope = self.add_type_filter(params, scope) # add our static scopes scope = self.add_static_scopes(params, scope) scope = self.add_dynamic_scopes(params, scope) scope = self.add_pagination(params, scope) scope end |
#scope_definition ⇒ Hash
Scope definition
54 55 56 57 58 59 60 |
# File 'lib/autoscope/active_record_methods.rb', line 54 def scope_definition self.stored_scope_definition.clone.tap do |ret| self.scope_class_methods.each do |meth| ret[meth] = self.get_scope_parameters(self.method(meth)) end end end |