##// END OF EJS Templates
Wrap conditions with a single if new_record?....
Jean-Philippe Lang -
r15819:ae99ecd54fce
parent child
Show More
@@ -36,14 +36,16 class UserPreference < ActiveRecord::Base
36
36
37 def initialize(attributes=nil, *args)
37 def initialize(attributes=nil, *args)
38 super
38 super
39 if new_record? && !(attributes && attributes.key?(:hide_mail))
39 if new_record?
40 self.hide_mail = Setting.default_users_hide_mail?
40 unless attributes && attributes.key?(:hide_mail)
41 end
41 self.hide_mail = Setting.default_users_hide_mail?
42 if new_record? && !(attributes && attributes.key?(:time_zone))
42 end
43 self.time_zone = Setting.default_users_time_zone
43 unless attributes && attributes.key?(:time_zone)
44 end
44 self.time_zone = Setting.default_users_time_zone
45 if new_record? && !(attributes && attributes.key?(:no_self_notified))
45 end
46 self.no_self_notified = true
46 unless attributes && attributes.key?(:no_self_notified)
47 self.no_self_notified = true
48 end
47 end
49 end
48 self.others ||= {}
50 self.others ||= {}
49 end
51 end
General Comments 0
You need to be logged in to leave comments. Login now