Assuming that we have a player model and a game model and that each game
has multiple players as described below.
class Game < ActiveRecord::Base
has_many :players
def some_method
#
# which player called me?
#
end
end
class Player < ActiveRecord::Base
belongs_to :game
end
Is there a way to determine which player called some_method in the game
when called through one of the players and without explicitly adding the
player to the argument list? For example …
Player.find(id).game.some_method();
Thanks