I'm not sure if this is a rails method or a ruby method but I am looking f开发者_Python百科or details about what happens when you call @object.save.
http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save
saveis a Rails method defined within theActiveRecord::Persistencemodule. It saves the model. If the model is new, a record gets created in the database, otherwise the existing record gets updated.By default,
savealways run validations. If any of them fail the action is cancelled andsavereturns false. However, if you supply:validate => false, validations are bypassed altogether.There’s a series of callbacks associated with the
savemethod. If any of thebefore_*callbacks return false the action is cancelled andsavereturns false.The
save!(bang) method always runs validations but raises anActiveRecord::RecordInvalidexception upon validation failure.
加载中,请稍侯......
精彩评论