ruby on rails - find all that are nil in the association -


so have post , user.
post has_many users , user belongs_to post.
need find find posts dont have users following:

post.first.users  => []  

post.where("id not in (select post_id users)") 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

java - where to store the user credentials in an enterprise application(EAI)? -

openxml - Programmatically format a date in an excel sheet using Office Open Xml SDK -