Show player inventory
This commit is contained in:
parent
5f91ea116a
commit
86d5bc85f2
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user