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.
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
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.