在从Devise :: RegistrationsController继承的自定义注册控制器中保存之前,如何修改User实例的属性?
You gave the answer yourself. In your model do:
class User < ActiveRecord::Base
before_save :set_attributes
def set_attributes
// Change the attributes to what you like
end
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.