Forum: Ruby on Rails How can I get a list of all associations from my model

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kretch K. (Guest)
on 2009-04-10 11:28
(Received via mailing list)
Hi All

I have a model defined as follows:

class a< ActiveRecord::Base
  has_many :a_b_mappings
  has_many :bs, :through => :a_b_mappings, :uniq => true

  has_many :a_c_mappings
  has_many :cs, :through => :a_c_mappings, :uniq=> true

  has_many :a_d_mappings
  has_many :ds, :through => :a_d_mappings, :uniq => true



I'm trying to find a class method that will enumerate all the classes
(:bs,:cs,:ds,...) being associated from class a.
I'm at a loss as to what hooks ActiveRecord provides that would enable
me to do that.

Thanks much
This topic is locked and can not be replied to.