I hope someone has already experienced this. Please help me, how can i solve this problem:
class Article < ActiveRecord::Base
belongs_to :author
belongs_to :publisher
has_one :address, :through => :publisher
end
class Author < ActiveRecord::Base
has_many :articles
has_many :addresses, :through => :articles, :source => :address
end
I try to get "addresses" for "author", and i get this error in console:
ActiveRecord::HasManyThroughSourceAssociationMacroError: Invalid source reflection macro :has_one :through for has_many :addresses, :through => :articles. Use :source to specify the source reflection.
but author.articles[0].address
works fine.
I hope you give me advice, how can i solve it. Thanks.