squeel icon indicating copy to clipboard operation
squeel copied to clipboard

TypeError: Cannot visit FalseClass when using .nil?

Open qoyyim opened this issue 10 years ago • 3 comments

i have this query where{((valid_from >= my{date}) | (valid_from.nil?)) & ((valid_to <= my{date}) | (valid_to.nil?))}

and when i run it it's got that error

qoyyim avatar Oct 17 '14 09:10 qoyyim

umm i already found the "right" way to using it in squeel (using == nil) but i already accustomed using .nil? and .present?

nb: btw i seen Your post in the blog if You busy, don't have time to fix this can You just give me pointer how to patch it myself

qoyyim avatar Oct 17 '14 11:10 qoyyim

Not very easy, and I am not sure how necessary to add this feature. Maybe you could hack Squeel::Nodes::Stub in your application?

bigxiang avatar Oct 26 '14 16:10 bigxiang

Hi @qoyyim,

It is such a coincidence, we also encountered the same error on our Rails app. It happens after we cleaned up the code due to http://www.rubydoc.info/github/bbatsov/rubocop/Rubocop/Cop/Style/NilComparison which make this error appears (well, again).

We have reverted back the change. But out of curiosity, did you manage to find out why this happen? 😄

fikriauliya avatar Dec 14 '16 09:12 fikriauliya