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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6688498883b5a9631e3f04dc614eec75?d=identicon&s=25 Kretch Kretchmer (kretch)
on 2009-04-10 09: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

...

end


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
Kretch
This topic is locked and can not be replied to.