search for: products_with_root

Displaying 1 result from an estimated 1 matches for "products_with_root".

2009 Mar 16
4
Overriding ActiveRecord associations for special cases
...emember to call it with a .all/.find or similar method: ''user.products.all'' instead of ''user.products''. Ideally I guess I want to return a proxy object that represents all products. Any ideas? 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 Best regards, Andrew France --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ru...