diff --git a/app/controllers/tables_controller.rb b/app/controllers/tables_controller.rb index e0e551d0..a3c473d6 100644 --- a/app/controllers/tables_controller.rb +++ b/app/controllers/tables_controller.rb @@ -31,15 +31,17 @@ class TablesController < ApplicationController # GET /tables/1 # GET /tables/1.json def show - authorize @game - # TODO refactor to ensure play for 2nd and 3rd place + authorize @table + if @game + authorize @game + # TODO refactor to ensure play for 2nd and 3rd place - if @game.controlling_player.try("is_bot?") - @game.controlling_player.auto_play - @game.save - @game.reload + if @game.controlling_player.try("is_bot?") + @game.controlling_player.auto_play + @game.save + @game.reload + end end - end def new_game diff --git a/app/models/table.rb b/app/models/table.rb index 58bd6557..9fa5fb4a 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -13,7 +13,7 @@ class Table < ActiveRecord::Base #TODO: Should these be part of Game initialize instead of callback? after_create :add_seats - after_create :add_game + # after_create :add_game # Returns the newest joinable table or creates a new table if none are found # scope :play_now, lambda { |user| diff --git a/app/policies/seat_policy.rb b/app/policies/seat_policy.rb index fc472aae..7fa409ee 100644 --- a/app/policies/seat_policy.rb +++ b/app/policies/seat_policy.rb @@ -26,6 +26,10 @@ class SeatPolicy true end + def stand? + true + end + def sit? true end diff --git a/app/policies/table_policy.rb b/app/policies/table_policy.rb index 2ed00da1..112186b1 100644 --- a/app/policies/table_policy.rb +++ b/app/policies/table_policy.rb @@ -7,7 +7,7 @@ class TablePolicy end def index? - @current_user.admin? + false end def show? diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index a5c9d263..e308b0bd 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -30,7 +30,7 @@ class UserPolicy end def show? - @current_user.admin? || @current_user == @user || @user.admin? + @current_user.admin? || @current_user == @user end def update? diff --git a/app/views/layouts/_navigation_links.html.erb b/app/views/layouts/_navigation_links.html.erb index 3aed9fb7..cc1dcabf 100644 --- a/app/views/layouts/_navigation_links.html.erb +++ b/app/views/layouts/_navigation_links.html.erb @@ -1,18 +1,18 @@