This is a separate question, but it is related to an earlier question: Three columns Join Rails with an active scaffold . To summarize: Rails automatically looks for a join table with two columns, but it does not do the same for a join table with three columns. I tried the sentences in the previous question, but it comes down to the following:
If you have Project, Employee, Role models and everyone has a habtm relation to the other two, the rails will fulfill each relationship separately, but not as a whole.
class Employee < ActiveRecord::Base
has_and_belongs_to_many :roles
has_and_belongs_to_many :projects
end
repeated for Project, Role follows
class Role < ActiveRecord::Base
has_and_belongs_to_many :employees
has_and_belongs_to_many :projects
end
, , rails employees_projects, projects_roles, employees_roles, employees_projects_roles, - CRUD (MySQL PostgreSQL )?
[]
. , . hmt habtm. , , .