Method: ActiveModel::Datastore::ClassMethods#query_property_filter
- Defined in:
- lib/active_model/datastore.rb
#query_property_filter(query, options) ⇒ Object
Adds property filters to the query if included in the options. Accepts individual or nested Arrays:
[['superseded', '=', false], ['email', '=', 'something']]
470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/active_model/datastore.rb', line 470 def query_property_filter(query, ) if [:where] opts = [:where] if opts[0].is_a?(Array) opts.each do |opt| query.where(opt[0], opt[1], opt[2]) unless opt.nil? end else query.where(opts[0], opts[1], opts[2]) end end query end |