Skip to content

Instantly share code, notes, and snippets.

@arturo-c
Created October 23, 2013 04:22
Show Gist options
  • Save arturo-c/7112573 to your computer and use it in GitHub Desktop.
Save arturo-c/7112573 to your computer and use it in GitHub Desktop.
class User
has_one :game, as :flag
end
class Game
belongs_to :flag, polymorphic: true
end
user = User.find(user_id)
game = Game.find(game_id)
user.flag(game)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment