module TheWhere::Not
Public Instance Methods
filter_not(params)
click to toggle source
# 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)
click to toggle source
# 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