Ruby Rails update all atrribute using param -


currently im using code update 1 attribute, there way can update 'title' @ once ? using update_all maybe ?

title= params['myform']['title'] @book.update_attribute(:title, title) 

thanks!

yes there way:

modelname.update_all(:title => title) 

more details here.


Comments

Popular posts from this blog

node.js - StackOverflow API not returning JSON -

php - Laravel 4.1 to Heroku: SQLSTATE[HY000] [2002] No such file or directory -

visual studio - How to generate shader debug information (pdb) in VS2012 -