Hi Chris, Yes they are synchronous, one thing which might stop it saving is validations failing, .save should return true if it works, otherwise check .errors
-IV On 01/02/2011, at 4:36 PM, Chris Mayan wrote: > Hi all, > > Just quick query that's been bugging me this afternoon: > > Is .save / .save! synchronous? > i.e. After I call that line - should the database row be created in > the DB before executing the next line? > > I'm just puzzled as to why step by step debugging, I don't see the DB > row created at all even several lines afterwards. > > Is this because the .save! is inside a transaction block, so Rails on > purpose does not actually do any DB actions until the very end of the > transaction block? > (I always though it committed, and then does a rollback if the > transaction fails... meaning I should still see that DB entry in there > after the .save line is executed irrespective of the transaction > block) > > Thanks, > Chris > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" 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/rails-oceania?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" 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/rails-oceania?hl=en.
