This is a separate question, but it is related to an earlier question: Three Column Join in Rails with Active Scaffold. To sum up: Rails automatically looks for a two colum
I'm assuming that you have something like this joining your models together:
def self.up
create_table :my_join_table, :id => false do |t|
t.integer :employee_id
t.integer :role_id
t.integer :project_id
t.timestamps
end
end
If so you, simply need to specify the name of the join table to use with your habtm.
class Employee < ActiveRecord::Base
has_and_belongs_to_many :roles, :join_table => "my_join_table"
has_and_belongs_to_many :projects, :join_table => "my_join_table"
end
class Project < ActiveRecord::Base
has_and_belongs_to_many :roles, :join_table => "my_join_table"
has_and_belongs_to_many :employees, :join_table => "my_join_table"
end
class Role < ActiveRecord::Base
has_and_belongs_to_many :employees, :join_table => "my_join_table"
has_and_belongs_to_many :projects, :join_table => "my_join_table"
end