diff --git a/app/controllers/quests_controller.rb b/app/controllers/quests_controller.rb index 4fca22e..86a6413 100644 --- a/app/controllers/quests_controller.rb +++ b/app/controllers/quests_controller.rb @@ -3,6 +3,10 @@ def index @quests = Quest.all end + def show + @quest = Quest.find(params[:id]) + end + def assign @quest = Quest.find(params[:id]) @assignment = @quest.assignments.build user: current_user diff --git a/app/models/place.rb b/app/models/place.rb index a4f5ebe..162c342 100644 --- a/app/models/place.rb +++ b/app/models/place.rb @@ -1,2 +1,4 @@ class Place < ApplicationRecord + has_many :adventures + has_many :quests, through: :adventures # place.quests end diff --git a/app/models/quest.rb b/app/models/quest.rb index fdb9b67..5f68174 100644 --- a/app/models/quest.rb +++ b/app/models/quest.rb @@ -1,8 +1,8 @@ class Quest < ApplicationRecord has_many :adventures - has_many :places, through: :adventures - has_many :assignments - has_many :users, through: :assignments + has_many :places, through: :adventures # quest.places + + # doesn't need quest.users (yet) def add_user(user) users << user diff --git a/app/models/user.rb b/app/models/user.rb index feab449..ae6ff2a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,6 @@ class User < ApplicationRecord has_secure_password + has_many :assignments - has_many :quests, through: :assignments + has_many :quests, through: :assignments # user.quests end diff --git a/app/views/quests/index.html.erb b/app/views/quests/index.html.erb index 424b1b5..e556cfc 100644 --- a/app/views/quests/index.html.erb +++ b/app/views/quests/index.html.erb @@ -1,15 +1,8 @@