stash play hand logic

This commit is contained in:
Jesse C. Fisher 2015-05-03 13:13:53 -07:00
parent a83c0679d7
commit a0eaee2a45
5 changed files with 32 additions and 0 deletions

5
app/models/play.rb Normal file
View 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

View 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

View 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
View 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
View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Play, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end