Skip to content

Step 2 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/pokemon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# description :text
# created_at :datetime
# updated_at :datetime
# user_id :integer
#

class Pokemon < ActiveRecord::Base
belongs_to :user
end
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
#

class User < ActiveRecord::Base
has_many :pokemons
end
5 changes: 5 additions & 0 deletions db/migrate/20141015033026_add_user_id_to_pokemons.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserIdToPokemons < ActiveRecord::Migration
def change
add_column :pokemons, :user_id, :integer
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141015022422) do
ActiveRecord::Schema.define(version: 20141015033026) do

create_table "pokemons", force: true do |t|
t.string "name"
t.integer "level"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
end

create_table "users", force: true do |t|
Expand Down