diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 18:21:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 18:21:32 +0000 |
commit | 31c33f462d92aead29b8feb6445d8fe5626c4963 (patch) | |
tree | 0818c626e553e1cbb606e9c23a7342583288d448 /app/models/repository.rb | |
parent | 013c6fe009e74892659c64c2936a2668a9663985 (diff) | |
download | redmine-31c33f462d92aead29b8feb6445d8fe5626c4963.tar.gz redmine-31c33f462d92aead29b8feb6445d8fe5626c4963.zip |
Replaces find(:first) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10928 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index e31bc3557..a8e967d0d 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -234,12 +234,15 @@ class Repository < ActiveRecord::Base def find_changeset_by_name(name) return nil if name.blank? s = name.to_s - changesets.find(:first, :conditions => (s.match(/^\d*$/) ? - ["revision = ?", s] : ["revision LIKE ?", s + '%'])) + if s.match(/^\d*$/) + changesets.where("revision = ?", s).first + else + changesets.where("revision LIKE ?", s + '%').first + end end def latest_changeset - @latest_changeset ||= changesets.find(:first) + @latest_changeset ||= changesets.first end # Returns the latest changesets for +path+ @@ -301,7 +304,7 @@ class Repository < ActiveRecord::Base return @found_committer_users[committer] if @found_committer_users.has_key?(committer) user = nil - c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user) + c = changesets.where(:committer => committer).includes(:user).first if c && c.user user = c.user elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/ |