使用update_attribute和validation

2023-04-20,

在使用update_attribute方法时,不走validation

走validation的方法:

create
create!
save
save!
update
update_attributes
update_attributes!

跳过validation的方法:

decrement!
decrement_counter
increment!
increment_counter
toggle!
touch
update_all
update_attribute
update_column
update_counters

使用update_attribute和validation的相关教程结束。

《使用update_attribute和validation.doc》

下载本文的Word格式文档,以方便收藏与打印。