0

I have three models Company < Deed < Subtransaction, with has_many / belongs_to relationships and where Company has_many :subtransactions, through: :deeds

So: Subtransaction references deed_id where Deed references company_id

In my rails console I can query Company.first.subtransactions succesfully. However, Subtransaction.first.company returns an error. If I add belongs_to :company to the model, it still returns nil.

How can I access the grand-parent company object from the child Subtransaction model?`

Matthias
  • 1,884
  • 2
  • 18
  • 35

0 Answers0