使用update_attribute和validation

在使用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
posted @ 2013-08-03 23:42  wangyuyu  阅读(343)  评论(0编辑  收藏  举报