Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

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

Open
tomash opened this issue Jul 11, 2012 · 0 comments
Open

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

tomash opened this issue Jul 11, 2012 · 0 comments

Comments

@tomash
Copy link

tomash commented Jul 11, 2012

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant