diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-10-15 12:24:05 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-10-15 12:24:05 +0300 |
commit | 59b6564e45151fc8e01518d5ce687699e4047bd1 (patch) | |
tree | dc2659aeeaa4720da5d34b2de613e3b052c5db09 /app/models | |
parent | dc9100d1b21e8c76aaa3899411e4978c319b743d (diff) |
address commentsupdate_passwd_service
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project_services/teamcity_service.rb | 2 | ||||
-rw-r--r-- | app/models/service.rb | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb index 3ff02ee75e2..1665c74cd7f 100644 --- a/app/models/project_services/teamcity_service.rb +++ b/app/models/project_services/teamcity_service.rb @@ -45,7 +45,7 @@ class TeamcityService < CiService end def reset_password - if prop_updated?(:teamcity_url) && !prop_updated?(:password) + if prop_updated?(:teamcity_url) && !password_touched? self.password = nil end end diff --git a/app/models/service.rb b/app/models/service.rb index af5ce1635a6..eaf1eaca146 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -125,8 +125,9 @@ class Service < ActiveRecord::Base # ActiveRecord does not provide a mechanism to track changes in serialized keys. # This is why we need to perform extra query to do it mannually. def prop_updated?(prop_name) - return false if send("#{prop_name}_was").nil? - send("#{prop_name}_was") != send(prop_name) + value_was = send("#{prop_name}_was") + return false if value_was.nil? + value_was != send(prop_name) end def async_execute(data) |