If say I have this class: class MyClass self.belongs_to(:user) end Is there a way to programatically determine who MyClass belongs to? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
look at ActiveRecord::Reflection::ClassMethods, specifically the reflect_on_all_associations() and reflections() methods Adam On 12/17/07, Paul Davidowitz <pdavidow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > If say I have this class: > > class MyClass > self.belongs_to(:user) > end > > Is there a way to programatically determine who MyClass belongs to? > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
oops, forgot to post the link http://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html On 12/17/07, Adam Cohen <bionicboogie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> look at ActiveRecord::Reflection::ClassMethods, specifically the > reflect_on_all_associations() and reflections() methods > > > Adam > > On 12/17/07, Paul Davidowitz <pdavidow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > If say I have this class: > > > > class MyClass > > self.belongs_to(:user) > > end > > > > Is there a way to programatically determine who MyClass belongs to? > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---