Skip to content

Instantly share code, notes, and snippets.

@jamescook
Created January 23, 2012 13:58
Show Gist options
  • Save jamescook/1663291 to your computer and use it in GitHub Desktop.
Save jamescook/1663291 to your computer and use it in GitHub Desktop.
Scope
# named_scope :relative_of, lambda { |id|
# subject = Subject.find(id)
# ids = subject.child_subjects.map(&:id)
# ids << id
# { :conditions => { :subject_id => ids } }
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment