Skip to content

Instantly share code, notes, and snippets.

@andreasronge
Created September 3, 2014 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasronge/704077a5caa8024b172d to your computer and use it in GitHub Desktop.
Save andreasronge/704077a5caa8024b172d to your computer and use it in GitHub Desktop.
# Lets find me:
me = Human.where(name: 'andreas').first
# And my posh cat:
dutchess = me.pets.where(character: 'posh').first
# And find all cat owners that have a posh cat mummy:
Cat.as(:c).where("c.character='posh'").kittens(:k).owner.first # => me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment