Define player cards
This commit is contained in:
parent
1278f38814
commit
1d2d213a91
@ -1,4 +1,3 @@
|
|||||||
class PlayerCard < ActiveRecord::Base
|
class PlayerCard < ActiveRecord::Base
|
||||||
belongs_to :player
|
belongs_to :player
|
||||||
belongs_to :card
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -17,6 +17,10 @@
|
|||||||
%ol
|
%ol
|
||||||
- @game.players.each do |player|
|
- @game.players.each do |player|
|
||||||
%li= player
|
%li= player
|
||||||
|
- unless player.player_cards.empty?
|
||||||
|
%ul.cards
|
||||||
|
- player.player_cards.each do |card|
|
||||||
|
%li= [card.rank, card.suit].join(' ')
|
||||||
|
|
||||||
= link_to 'Edit', edit_game_path(@game)
|
= link_to 'Edit', edit_game_path(@game)
|
||||||
\|
|
\|
|
||||||
|
|||||||
7
db/migrate/20150409115031_add_attrs_to_player_cards.rb
Normal file
7
db/migrate/20150409115031_add_attrs_to_player_cards.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class AddAttrsToPlayerCards < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :player_cards, :value, :integer
|
||||||
|
add_column :player_cards, :rank, :string
|
||||||
|
add_column :player_cards, :suit, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150104203850) do
|
ActiveRecord::Schema.define(version: 20150409115031) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@ -28,6 +28,9 @@ ActiveRecord::Schema.define(version: 20150104203850) do
|
|||||||
t.integer "card_id"
|
t.integer "card_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.integer "value"
|
||||||
|
t.string "rank"
|
||||||
|
t.string "suit"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "player_cards", ["card_id"], name: "index_player_cards_on_card_id", using: :btree
|
add_index "player_cards", ["card_id"], name: "index_player_cards_on_card_id", using: :btree
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user