activerecord-hackery / meta_search

Object-based searching (and more) for simply creating search forms. Not currently maintained.
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
903 stars 140 forks source link

field_in overwrites field_equals. is it official and intended? #103

Open tomash opened 12 years ago

tomash commented 12 years ago

In a site I'm developing there is an option to filter by given value, but that should also return records where this value has been left blank (as in "unspecified" / "whatever"). I've experimented with code like

if(search_params['gender_equals'])
  search_params.merge!({'gender_in' => [nil, '', search_params['gender_equals']].uniq})
end

and it works like charm, i.e. metasearch build sql query that does not have the "==" clause on this field, but has an "in" clause on it. but i just wanted to ask if it's intentional and maybe documented somewhere (i.e. suffix-precedence)?

if yes, is that behavior carried on to ransack as well? we'll be migrating soon.