Module: WhereableScope::ScopeHandler
- Included in:
- QueryMethods, WhereChainExtension
- Defined in:
- lib/whereable_scope/scope_handler.rb
Instance Method Summary collapse
-
#extract_whereable_scopes(opts, model) {|scope| ... } ⇒ Object
Extracts whereable scope parameters from opts hash and applies them.
Instance Method Details
#extract_whereable_scopes(opts, model) {|scope| ... } ⇒ Object
Extracts whereable scope parameters from opts hash and applies them. Yields each resolved scope to the block for custom handling.
9 10 11 12 13 14 15 16 |
# File 'lib/whereable_scope/scope_handler.rb', line 9 def extract_whereable_scopes(opts, model) model.whereable_scopes.each do |key, scope_name| value = opts.delete(key.to_sym) if value yield model.public_send(scope_name, value) end end end |