On Sunday 12 September 2010, Heinz Strunk wrote: > after_create :write_comments > > protected > def write_comments > comment = Comment.new > comment.text = "some text" > comment.user = self > comment.save! > end > > There's not one single comment in the database but when I create a > user using the console the comment is created after I save the user.
Is the after_create callback ever executed? Add a puts to make sure. > Anyone knows what's wrong here? I wouldn't write code like that to begin with. This is much nicer: def write_comments user.comments.create!(:text => 'some text') end Michael -- Michael Schuerig mailto:[email protected] http://www.schuerig.de/michael/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

