Skip a bunch of useless "UPDATE repositories SET extra_info = ..." queries when navigating in repositories.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8658 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-16 17:52:54 +00:00
parent fef82e44a6
commit 34d1683087
1 changed files with 6 additions and 2 deletions

View File

@ -101,9 +101,13 @@ class Repository < ActiveRecord::Base
end end
def scm def scm
@scm ||= self.scm_adapter.new(url, root_url, unless @scm
@scm = self.scm_adapter.new(url, root_url,
login, password, path_encoding) login, password, path_encoding)
update_attribute(:root_url, @scm.root_url) if root_url.blank? if root_url.blank? && @scm.root_url.present?
update_attribute(:root_url, @scm.root_url)
end
end
@scm @scm
end end