Mark Alexander Friedgan
2005-Jul-01 17:13 UTC
how does one determine what associations an ActiveRecord has?
I am trying to generically traverse active records, but I cannot seem to determine which associations a particular class has. Does anyone have any ideas? For example I have a Customer that belongs to a Person given a customer how do i find out that it does indeed belong to a Person and know to call customer.person Mark _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Josh Knowles
2005-Jul-01 17:17 UTC
Re: how does one determine what associations an ActiveRecord has?
On 7/1/05, Mark Alexander Friedgan <hubrix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am trying to generically traverse active records, but I cannot seem to > determine which associations a particular class has. Does anyone have any > ideas?See ActiveRecord::Reflection::ClassMethods, provides ways to dynamically gather all agregations and associations. Josh