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

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -