Is there a way to exclude the results of recordset #1 from recordset #2 in Rails 3 or 4, Activerecord?
I have tried this before with ugly code trying to remove the id's by adding them to a hash and excluding them from the query.
Must be a clean way to remove certain id's or results from a recordset?
You can perform a negative where
like this:
Post.where.not(author: author)
Taken from here: http://guides.rubyonrails.org/active_record_querying.html#not-conditions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With