meta_search icon indicating copy to clipboard operation
meta_search copied to clipboard

field_in overwrites field_equals. is it official and intended?

Open tomash opened this issue 13 years ago • 0 comments

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.

tomash avatar Jul 11 '12 12:07 tomash