stash play hand logic
This commit is contained in:
parent
a83c0679d7
commit
a0eaee2a45
5
app/models/play.rb
Normal file
5
app/models/play.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class Play < ActiveRecord::Base
|
||||||
|
belongs_to :game, :foreign_key => "game_id"
|
||||||
|
belongs_to :player, :foreign_key => "player_id"
|
||||||
|
has_many :player_cards, :foreign_key => "play_id"
|
||||||
|
end
|
||||||
10
db/migrate/20150503133344_create_plays.rb
Normal file
10
db/migrate/20150503133344_create_plays.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreatePlays < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :plays do |t|
|
||||||
|
t.references :game, index: true
|
||||||
|
t.references :player, index: true
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20150503133556_add_play_id_to_player_card.rb
Normal file
5
db/migrate/20150503133556_add_play_id_to_player_card.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class AddPlayIdToPlayerCard < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :player_cards, :play_id, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
7
spec/factories/plays.rb
Normal file
7
spec/factories/plays.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :play do
|
||||||
|
game nil
|
||||||
|
player nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
5
spec/models/play_spec.rb
Normal file
5
spec/models/play_spec.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Play, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user