たupdate_attribute、update_attributes、update_attributes! はバリデーションやマスアサインメントによっては結構違いが出てしまうのでちょっとまとめた。
class User < ActiveRecord::Base
validates_length_of :first_name, :maximum => 5
end
@user = User.find(1) => <User id: 1, first_name : "Bob">
>>続きを読む
posted by digital-squad at 2012年04月18日 15時44分
|
Comment(0)
|
TrackBack(0)
|
Ruby on Rails / Ruby