Get all associations of an ActiveRecord class

Updated . Posted . Visible to the public.

YourClass.reflect_on_all_associations.map(&:name)

Get the class name by calling class_name, or the type of the association (belongs_to, has_many,...) by calling macro

Last edit
License
Source code in this card is licensed under the MIT License.
Posted to makandra dev (2012-10-31 19:37)