Skip to content

Instantly share code, notes, and snippets.

View hayksaakian's full-sized avatar
🏠
Working from home

Hayk Saakian hayksaakian

🏠
Working from home
View GitHub Profile
@hayksaakian
hayksaakian / routes
Created March 16, 2013 19:17
routes for a card game
# card belongs_to hand and a user
# hand belongs_to game
# game has_many spaces
/hands/:hand_id/cards/:card_id/spaces/:space_id/place?auth_token=TOKEN
/cards/:card_id/spaces/:space_id/place?auth_token=TOKEN
/cards/:card_id/place?auth_token=TOKEN&space_id=:space_id
@hayksaakian
hayksaakian / relations
Last active December 15, 2015 00:49
model relations for a card game
# game.rb
has_many :hands
has_and_belongs_to_many :users
embeds_many :spaces
# hand.rb
belongs_to :user
belongs_to :game
has_many :cards