Displaying 1 result from an estimated 1 matches for "set_last_post".
Did you mean:
  set_last_plot
  
2006 Jun 19
0
has_one frustrations, please help!
...ns would be topic-related. In the 
topic model I have the following associations:
-----
has_many(:posts)
has_one(:last_post, {:class_name => ''Post''})
-----
Next, in the same model, I have the following function which I call 
whenever a new post is added to a topic:
-----
def set_last_post
  self.last_post = self.posts.last
end
-----
Posts are added properly to the topics (@topic.posts << @post; 
@topic.save), yet somehow, every topic I add has NULL for the 
last_post_id. Please help, I''m losing my mind.
-- 
Posted via http://www.ruby-forum.com/.