I would like to know which "has_many" associations my ActiveRecord model
has.
Example, given this model:
class Post < ActiveRecord::Base
has_many :comments
end
I need a method that does this:
@associations = Post.has_many_associations
@association.each do |a|
puts a # should print "comments"
end
Can you help me ? This method exists ? Is it possible ?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment