在spree sign_up中app/models/spree/user.rb
有
def set_login
# for now force login to be same as email, eventually we will make this configurable, etc.
self.login ||= self.email if self.email
end
如何覆盖set login并执行以下操作:
def set_login
# for now force login to be same as email, eventually we will make this configurable, etc.
self.login ||= self.phone if self.phone
end
提前致谢
答案 0 :(得分:0)
我是在app / models / spree / user_decorator.rb
中完成的 Spree::User.class_eval do
Spree::PermittedAttributes.user_attributes << :phone
def set_login
# for now force login to be same as email, eventually we will make this configurable, etc.
self.login ||= self.phone if self.phone
end
end