davidnwelton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-14 12:40 UTC
ActiveRecord introspection
Hi, I have a reasonably complex AR object, that has_many, contains foreign keys, and so on. How can I get the names of all the ''attribute methods''? Getting the column names isn''t so difficult, but getting the associations seems to be trickier... Thanks, Dave Welton --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 14, 2007, at 2:40 PM, davidnwelton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I have a reasonably complex AR object, that has_many, contains foreign > keys, and so on. How can I get the names of all the ''attribute > methods''? Getting the column names isn''t so difficult, but getting > the associations seems to be trickier...Take a look at the reflect_on_* methods in the API. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- Dr Nic’s Magic Models
- Self-referential has_many :through relationship
- Specify and validate requirements on an ActiveRecord association
- Validating an ActiveRecord object and its has_many :through associations
- How far to go with ActiveRecord unit tests without hitting the database?