ruby on rails - ActiveRecord How to verify a record has sucessfully saved on the database? -


i have learned hard way that

model.save 

will return true if record passes validations, if there errors adding/updating model @ database end, still returns true. therefore using

 if model.save        render 'yayy'  else        render 'error'  end 

is not reliable.

are there method has same functionality returns true if database updates or otherwise best way verify record has saved on database.

(if matters using postgres database)

check out activerecord::persistence.

besides others, there such methods, new_record? , persisted? might looking for.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -