I have the following setup:
class Publication < ActiveRecord::Base has_and_belongs_to_many :authors, :class_name=>'Person', :join_table => 'authors_publications' has_and_belongs_to_many :editors, :class_name=>'Person', :join_table => 'editors_publications' end class Person < ActiveRecord::Base has_and_belongs_to_many :publications end
With this setting, I can do something like Publication.first.authors . But if I want to list all the publications in which the person Person.first.publications is involved, this is an error related to the absence of the people_publications connection people_publications . How can i fix this?
Should I switch to separate models for authors and editors? However, this will lead to some redundancy of the database, since a person can be the author of one publication and the editor of another.
source share