In the Rails 5.1 application there is a request, in whose joins many links are written, and also this is found:

 # ... .where('blogs_informations.ignored_at IS NULL') # это не работает .where.not(viewed_at: nil) # это работает # ... 

But if IS NULL replaced with IS NOT NULL , then it will work.

joins contains the following links:

 current_user.posts_informations.joins(post: { blog: :blogs_informations }) 

Tell me, please, why this behavior and how to fix it?

  • Write in what it translates to SQL. Perhaps you will find it yourself by the type of obtained SQL - Small

0