activerecord-hackery / squeel

Active Record, improved. Live again :)
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
2.4k stars 213 forks source link

TypeError: Cannot visit FalseClass when using .nil? #342

Open qoyyim opened 10 years ago

qoyyim commented 10 years ago

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 commented 10 years ago

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

bigxiang commented 10 years ago

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

fikriauliya commented 7 years ago

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? 😄