Skip to content

Instantly share code, notes, and snippets.

@jtperreault
Forked from telagraphic/project.rb
Last active December 16, 2015 14:29
Show Gist options
  • Save jtperreault/5449063 to your computer and use it in GitHub Desktop.
Save jtperreault/5449063 to your computer and use it in GitHub Desktop.
class CreateProducts < ActiveRecord::Migration
def up
create_table :projects_users, :id => false do |t|
t.references :user, :null => false
t.references :project, :null => false
end
end
def down
drop_table :projects_users
end
end
class Project < ActiveRecord::Base
attr_accessible :description, :name
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation
has_secure_password
validates_uniqueness_of :email
has_and_belongs_to_many :projects
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment