, :
, ActiveRecord, - . - , .
Book.where('title LIKE ?', '%Rails%').update_all(author: 'David')
, raw SQL ( ) Rails ActiveRecord Rails ( ), , , Rails, , , .
:
Book.where('title LIKE ?', '%Rails%').update_all(author: 'David')
Book.where('title LIKE ?', '%Rails%').each do |b|
b.update(author: 'David')
end
SQL :
update books
set author = 'David'
where title like '%Rails%'
. - Rails-, , . /
, ActiveRecord, Ruby ( , , ,...), SQL UPDATE . , Rails CPU Ruby.
" ActiveRecord", , Rails, - - " ".
ActiveRecord . Model.all, , , . Rails, , , . ORM , .
2.2 :
. . ? Ruby . . , Ruby . , , 1G 3G . , 3G. . .
, .