Project
has_many :tasks
Task
has_many :invoices, :through => :line_items
has_many :line_items
LineItems
belongs_to :invoice
belongs_to :task
Invoice
has_many :tasks, :through=> :line_item
has_many :line_items
I’m trying to get an association from Project has_many :invoices, :through => :tasks
When I tried that, I get:
Invalid source reflection macro :has_many :through for has_many :invoices, :through => :tasks. Use :source to specify the source reflection.
I’m a little at a loss to if this is possible, and if so, how to use :source correctly
Ryan is right, this is supported from Rails 3.1. Extracted from the release notes:
Associations with a :through option can now use any association as the through or source association, including other associations which have a :through option and has_and_belongs_to_many associations.
Src: http://guides.rubyonrails.org/3_1_release_notes.html