summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-03 21:30:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-03 21:30:10 +0000
commitea296a109a8655ea48c02c1d0a9bb0d19002d236 (patch)
tree08b5e517e77e341cfdd5a23d649dd1e754074dd4 /app/models/query.rb
parenta7023dfa9b8e39e6e0a73e57d22823e8a4260b71 (diff)
downloadredmine-ea296a109a8655ea48c02c1d0a9bb0d19002d236.tar.gz
redmine-ea296a109a8655ea48c02c1d0a9bb0d19002d236.zip
Replaces find(:first/:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10931 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 84f8c3ef6..409095434 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -685,12 +685,14 @@ class Query < ActiveRecord::Base
order_option = [group_by_sort_order, options[:order]].reject {|s| s.blank?}.join(',')
order_option = nil if order_option.blank?
- issues = Issue.visible.scoped(:conditions => options[:conditions]).find :all, :include => ([:status, :project] + (options[:include] || [])).uniq,
- :conditions => statement,
- :order => order_option,
- :joins => joins_for_order_statement(order_option),
- :limit => options[:limit],
- :offset => options[:offset]
+ issues = Issue.visible.where(options[:conditions]).all(
+ :include => ([:status, :project] + (options[:include] || [])).uniq,
+ :conditions => statement,
+ :order => order_option,
+ :joins => joins_for_order_statement(order_option),
+ :limit => options[:limit],
+ :offset => options[:offset]
+ )
if has_column?(:spent_hours)
Issue.load_visible_spent_hours(issues)
@@ -721,11 +723,13 @@ class Query < ActiveRecord::Base
# Returns the journals
# Valid options are :order, :offset, :limit
def journals(options={})
- Journal.visible.find :all, :include => [:details, :user, {:issue => [:project, :author, :tracker, :status]}],
- :conditions => statement,
- :order => options[:order],
- :limit => options[:limit],
- :offset => options[:offset]
+ Journal.visible.all(
+ :include => [:details, :user, {:issue => [:project, :author, :tracker, :status]}],
+ :conditions => statement,
+ :order => options[:order],
+ :limit => options[:limit],
+ :offset => options[:offset]
+ )
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
end
@@ -733,7 +737,10 @@ class Query < ActiveRecord::Base
# Returns the versions
# Valid options are :conditions
def versions(options={})
- Version.visible.scoped(:conditions => options[:conditions]).find :all, :include => :project, :conditions => project_statement
+ Version.visible.where(options[:conditions]).all(
+ :include => :project,
+ :conditions => project_statement
+ )
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
end