search for: rescued_id

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

2006 Apr 10
6
Object isn''t being saved when called through association
...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''m finding is that if I take a player and do player.rescue_player p Then it doesn''t actually save the results from the g...
2006 Apr 11
0
Trying to come up with a nice DSL, but having some problems
...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 I want to do is be able to create a game object and do something like this: g = create_game # factory method in test_helper that just cre...