I have two ActiceRecord classes:
class A < ActiveRecord::Base
has_one :b
end
class B < ActiveRecord::Base
belongs_to :a
end
How do I determine the object to which B is associated to when the associations between A and B are only initialized e.g. at runtime?
I am looking for something like this:
b.association => A
I’m not sure if this would help you but
…will give you a Hash of associations at class level. You could filter through those.
For example: