search for: rescue_play

Displaying 2 results from an estimated 2 matches for "rescue_play".

Did you mean: rescue_player
2006 Apr 10
6
Object isn''t being saved when called through association
I have three models in this small game I''m working on - the Game, Players, and Turns. A Player should be able to rescue another Player on any given turn. So it looks like this: class Game has_many :players has_many :turns def rescue_player(p) t = turns.last t.rescued = p t.save end end class Turn belongs_to :rescued, :foreign_key => ''rescued_id'', :class_name => ''Player'' end class Player belongs_to :game def rescue_player(p) game.rescue_player p end end What I&...
2006 Apr 11
0
Trying to come up with a nice DSL, but having some problems
I have three models in this small game I''m working on - the Game, Players, and Turns. A Player should be able to rescue another Player on any given turn. So it looks like this: class Game has_many :players has_many :turns def rescue_player(p) t = turns.last t.rescued = p t.save end end class Turn belongs_to :rescued, :foreign_key => ''rescued_id'', :class_name => ''Player'' end class Player belongs_to :game def rescue_player(p) game.rescue_player p end end So what...