Commit 4a6a1c2ed3bef62e1a27227db41b63e1ba7a99c9
Committed by
Rafael Manzo
1 parent
fa1013f0
Exists in
colab
and in
4 other branches
Created ProjectOwnership model
Already associated it with User
Showing
7 changed files
with
41 additions
and
1 deletions
Show diff stats
app/models/user.rb
... | ... | @@ -8,5 +8,6 @@ class User < ActiveRecord::Base |
8 | 8 | validates :email, presence: true |
9 | 9 | validates :email, uniqueness: true |
10 | 10 | |
11 | + has_many :project_ownerships | |
11 | 12 | # Alert: when adding new parameters to this model, they should also be added to registrations_controller |
12 | 13 | end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,14 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(version: 20130627183652) do | |
14 | +ActiveRecord::Schema.define(version: 20130826211404) do | |
15 | + | |
16 | + create_table "project_ownerships", force: true do |t| | |
17 | + t.integer "user_id" | |
18 | + t.integer "project_id" | |
19 | + t.datetime "created_at" | |
20 | + t.datetime "updated_at" | |
21 | + end | |
15 | 22 | |
16 | 23 | create_table "users", force: true do |t| |
17 | 24 | t.string "name", default: "", null: false | ... | ... |
spec/models/user_spec.rb