Skip to content

Instantly share code, notes, and snippets.

@vladimir-e
Last active August 29, 2015 13:58
Show Gist options
  • Save vladimir-e/10261039 to your computer and use it in GitHub Desktop.
Save vladimir-e/10261039 to your computer and use it in GitHub Desktop.
Find record with zero has_many records associated #rails #activerecord (http://stackoverflow.com/questions/9613717/rails-find-record-with-zero-has-many-records-associated)
Photoset.includes(:photos).where(photos: {photoset_id: nil})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment