GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Filtering timestamps fields by blank or present generates a query error (on Postgres at least).
Postgres does not allow to compare a timestamp with "" (empty string).
This patch enables to filter timestamps with (not) null.
Filtering timestamps fields by blank or present generates a query err…
…or (on Postgres at least). They should be filtered by null.
Enable to filter null timestamps
I would have loved to write a test. However I did not find where (and if) JS is tested in rails_admin.
_blank and _present are pseudo-values that are aliased in main_controller when building the SQL request. I don't understand why you are modifying JS?
Because _blank and _present are meaningful for let's say filtering strings but not timestamps. Actually, a timestamp field cannot be an empty string in Postgres (I do not know for other DBs). It means that every timestamp field that are #blank? are also #nil?. Hence, filtering by null would, IMHO, be more appropriate. Isn't it?
Oh, yeah, sure. I didn't check the diff hard enough. _not_null and _null were already implemented, I guess.
Thanks for the patch.
Merge pull request #747 from jbescoyez/fix-timestamp-presence-filter
Filtering timestamps fields by blank or present generates a query error
Same deal on Postgres for acts_as_tree if you want to filter on parent rows i.e. those with a null, not empty, value. It falls into the belongs_to_assoc case which doesn't have those options. I verified it behaves as expected for my case but is it confusing to have blank & null options for all of these three?