Skip to content

Instantly share code, notes, and snippets.

@Odaeus
Created March 16, 2009 14:19
Show Gist options
  • Save Odaeus/79897 to your computer and use it in GitHub Desktop.
Save Odaeus/79897 to your computer and use it in GitHub Desktop.
class User
has_many :products
def root?
id == 1
end
def products_with_root
if root?
Product # Better way?
else
products_without_root
end
end
alias_method_chain :products, :root
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment