Show player inventory

This commit is contained in:
Jesse C. Fisher 2015-09-26 16:31:37 -07:00
parent 5f91ea116a
commit 86d5bc85f2
3 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,7 @@
class PlayersController < ApplicationController
before_action :set_player, only: [:show, :edit, :update, :destroy]
respond_to :html
respond_to :html, :json
def index
@players = Player.all
@ -9,6 +9,9 @@ class PlayersController < ApplicationController
end
def show
#TODO: Authorize
# e.g. retrieve own inventory but only inventory.count of other players
# and only other players in games to which you have access
respond_with(@player)
end

View File

@ -7,6 +7,10 @@
%b User:
= @player.user
%p
%b Inventory:
= @player.inventory.map{|c| c.class}
= link_to 'Edit', edit_player_path(@player)
\|
= link_to 'Back', players_path

View File

@ -1 +1 @@
json.extract! @player, :id, :game_id, :user_id, :created_at, :updated_at
json.extract! @player, :id, :game_id, :user_id, :inventory, :created_at, :updated_at