RAILS: How to get has_many associations of a model

Posted by Pioz on Stack Overflow See other posts from Stack Overflow or by Pioz
Published on 2010-05-21T08:36:05Z Indexed on 2010/05/21 8:40 UTC
Read the original article Hit count: 441

Filed under:
|
|
|

Hi, how I can get the has_many associations of a model?

For example if I have this class:

class A < ActiveRecord::Base
  has_many B
  has_many C
end

I would a method like this:

A.get_has_many

that return

[B,C]

Is it possible? Thanks!

© Stack Overflow or respective owner

Related posts about rails

Related posts about ruby-on-rails