Replaces find(:first/:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10931 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -32,10 +32,9 @@ class AdminController < ApplicationController
|
||||
def projects
|
||||
@status = params[:status] || 1
|
||||
|
||||
scope = Project.status(@status)
|
||||
scope = Project.status(@status).order('lft')
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
|
||||
@projects = scope.all(:order => 'lft')
|
||||
@projects = scope.all
|
||||
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
@@ -43,17 +43,22 @@ class BoardsController < ApplicationController
|
||||
|
||||
@topic_count = @board.topics.count
|
||||
@topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
|
||||
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC").order(sort_clause).all(
|
||||
:include => [:author, {:last_reply => :author}],
|
||||
:limit => @topic_pages.items_per_page,
|
||||
:offset => @topic_pages.current.offset)
|
||||
@topics = @board.topics.
|
||||
reorder("#{Message.table_name}.sticky DESC").
|
||||
includes(:author, {:last_reply => :author}).
|
||||
limit(@topic_pages.items_per_page).
|
||||
offset(@topic_pages.current.offset).
|
||||
order(sort_clause).
|
||||
all
|
||||
@message = Message.new(:board => @board)
|
||||
render :action => 'show', :layout => !request.xhr?
|
||||
}
|
||||
format.atom {
|
||||
@messages = @board.messages.find :all, :order => 'created_on DESC',
|
||||
:include => [:author, :board],
|
||||
:limit => Setting.feeds_limit.to_i
|
||||
@messages = @board.messages.
|
||||
reorder('created_on DESC').
|
||||
includes(:author, :board).
|
||||
limit(Setting.feeds_limit.to_i).
|
||||
all
|
||||
render_feed(@messages, :title => "#{@project}: #{@board}")
|
||||
}
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class DocumentsController < ApplicationController
|
||||
|
||||
def index
|
||||
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
||||
documents = @project.documents.find :all, :include => [:attachments, :category]
|
||||
documents = @project.documents.includes(:attachments, :category).all
|
||||
case @sort_by
|
||||
when 'date'
|
||||
@grouped = documents.group_by {|d| d.updated_on.to_date }
|
||||
|
||||
@@ -36,7 +36,7 @@ class TrackersController < ApplicationController
|
||||
|
||||
def new
|
||||
@tracker ||= Tracker.new(params[:tracker])
|
||||
@trackers = Tracker.find :all, :order => 'position'
|
||||
@trackers = Tracker.sorted.all
|
||||
@projects = Project.all
|
||||
end
|
||||
|
||||
|
||||
@@ -47,10 +47,7 @@ class UsersController < ApplicationController
|
||||
@user_count = scope.count
|
||||
@user_pages = Paginator.new self, @user_count, @limit, params['page']
|
||||
@offset ||= @user_pages.current.offset
|
||||
@users = scope.find :all,
|
||||
:order => sort_clause,
|
||||
:limit => @limit,
|
||||
:offset => @offset
|
||||
@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
||||
@@ -213,11 +213,12 @@ class WikiController < ApplicationController
|
||||
@version_count = @page.content.versions.count
|
||||
@version_pages = Paginator.new self, @version_count, per_page_option, params['page']
|
||||
# don't load text
|
||||
@versions = @page.content.versions.find :all,
|
||||
:select => "id, author_id, comments, updated_on, version",
|
||||
:order => 'version DESC',
|
||||
:limit => @version_pages.items_per_page + 1,
|
||||
:offset => @version_pages.current.offset
|
||||
@versions = @page.content.versions.
|
||||
select("id, author_id, comments, updated_on, version").
|
||||
reorder('version DESC').
|
||||
limit(@version_pages.items_per_page + 1).
|
||||
offset(@version_pages.current.offset).
|
||||
all
|
||||
|
||||
render :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user