I have an User model.
How I can get all associations between the User model with other models ?
I need to know the model names and the association type (1..1, 1..m, m..m ...)
I don't want to use the db/schema.rb file
I have an User model.
How I can get all associations between the User model with other models ?
I need to know the model names and the association type (1..1, 1..m, m..m ...)
I don't want to use the db/schema.rb file
Use reflect_on_all_associations class method on the User model.
This will return an array of reflection objects. On those objects you can call macro method to find out the association type (:has_many, :belongs_to, etc.), and klass method to know the, em, class of the associated object(s).