class UsersHaveAndBelongToManyRoles < ActiveRecord::Migration def self.up create_table :roles_users, :id => false do |t| t.references :role, :user end end def self.down drop_table :roles_users end end
And your models look like this:
# User Model class User < ActiveRecord::Base has_and_belongs_to_many :roles .... # Role model class Role < ActiveRecord::Base has_and_belongs_to_many :users end