Has many - Active Record

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

not perfect yet, but there is something like this…:

Post.reflect_on_association :comments

…that returns a boolean…

Not perfect yet…but helps…

On Sep 29, 3:09 pm, Anderson L. [email protected] wrote:

not perfect yet, but there is something like this…:

Post.reflect_on_association :comments

…that returns a boolean…

It should be returning a reflection object. see also the reflections
method and reflect_on_all_associations

Fred