Module: TheWhere::Not
- Included in:
- TheWhere
- Defined in:
- lib/the_where/not.rb
Instance Method Summary collapse
Instance Method Details
#filter_not(params) ⇒ Object
19 20 21 22 23 |
# File 'lib/the_where/not.rb', line 19 def filter_not(params) params.select do |k, _| k.end_with?('-not') end end |
#not_scope(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/the_where/not.rb', line 4 def not_scope(params) where_hash = {} params.each do |key, value| real_key = key.sub(/-not$/, '') where_hash.merge! real_key.to_sym => value end if where_hash.present? where.not(where_hash) else all end end |