I’m trying to set up a has_many through association, and it should go
through a belongs_to assocation.
has_many :videos, :through => :company
ActiveRecord::StatementInvalid: PGError: ERROR: column
companies.company_id does not exist
: SELECT videos.* FROM videos INNER JOIN companies ON
videos.company_id = companies.id WHERE ((companies.company_id = 1))
From the documentation:
“:through: Specifies a Join Model to perform the query through.
Options for :class_name and :foreign_key are ignored, as the
association uses the source reflection. You can only use a :through
query through a belongs_to or has_many association.”
So it seems as though I should be able to do it…but AR is doing the
join incorrectly. Any ideas?