Skip to content

Commit

Permalink
Add user to tunes
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjbowman committed Jun 7, 2019
1 parent 4a718bf commit dbfd544
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

Rails.application.routes.draw do
resources :tunes
resources :tunes, except: %i[new edit]
# RESTful routes
resources :examples, except: %i[new edit]

Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20190607143547_add_user_to_tunes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddUserToTunes < ActiveRecord::Migration[5.2]
def change
add_reference :tunes, :user, foreign_key: true
end
end
5 changes: 4 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_06_07_142623) do
ActiveRecord::Schema.define(version: 2019_06_07_143547) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -28,6 +28,8 @@
t.string "composer"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "user_id"
t.index ["user_id"], name: "index_tunes_on_user_id"
end

create_table "users", force: :cascade do |t|
Expand All @@ -41,4 +43,5 @@
end

add_foreign_key "examples", "users"
add_foreign_key "tunes", "users"
end

0 comments on commit dbfd544

Please sign in to comment.