Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10914 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1951c6a3fd
commit
5b21efd4a4
|
@ -23,7 +23,7 @@ class CustomFieldsController < ApplicationController
|
|||
before_filter :find_custom_field, :only => [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name }
|
||||
@custom_fields_by_type = CustomField.all.group_by {|f| f.class.name }
|
||||
@tab = params[:tab] || 'IssueCustomField'
|
||||
end
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class DocumentsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@attachments = @document.attachments.find(:all, :order => "created_on DESC")
|
||||
@attachments = @document.attachments.all
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -40,10 +40,12 @@ class MessagesController < ApplicationController
|
|||
|
||||
@reply_count = @topic.children.count
|
||||
@reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page
|
||||
@replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}],
|
||||
:order => "#{Message.table_name}.created_on ASC",
|
||||
:limit => @reply_pages.items_per_page,
|
||||
:offset => @reply_pages.current.offset)
|
||||
@replies = @topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on ASC").
|
||||
limit(@reply_pages.items_per_page).
|
||||
offset(@reply_pages.current.offset).
|
||||
all
|
||||
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
render :action => "show", :layout => false if request.xhr?
|
||||
|
|
|
@ -57,11 +57,10 @@ class ProjectsController < ApplicationController
|
|||
format.api {
|
||||
@offset, @limit = api_offset_and_limit
|
||||
@project_count = Project.visible.count
|
||||
@projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft')
|
||||
@projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
||||
}
|
||||
format.atom {
|
||||
projects = Project.visible.find(:all, :order => 'created_on DESC',
|
||||
:limit => Setting.feeds_limit.to_i)
|
||||
projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
||||
}
|
||||
end
|
||||
|
@ -145,7 +144,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
@users_by_role = @project.users_by_role
|
||||
@subprojects = @project.children.visible.all
|
||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
|
||||
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
|
||||
@trackers = @project.rolled_up_trackers
|
||||
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
|
|
|
@ -90,6 +90,6 @@ class ReportsController < ApplicationController
|
|||
private
|
||||
|
||||
def find_issue_statuses
|
||||
@statuses = IssueStatus.find(:all, :order => 'position')
|
||||
@statuses = IssueStatus.sorted.all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -141,10 +141,11 @@ class RepositoriesController < ApplicationController
|
|||
@changeset_pages = Paginator.new self, @changeset_count,
|
||||
per_page_option,
|
||||
params['page']
|
||||
@changesets = @repository.changesets.find(:all,
|
||||
:limit => @changeset_pages.items_per_page,
|
||||
:offset => @changeset_pages.current.offset,
|
||||
:include => [:user, :repository, :parents])
|
||||
@changesets = @repository.changesets.
|
||||
limit(@changeset_pages.items_per_page).
|
||||
offset(@changeset_pages.current.offset).
|
||||
includes(:user, :repository, :parents).
|
||||
all
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false if request.xhr? }
|
||||
|
|
|
@ -37,7 +37,7 @@ class TrackersController < ApplicationController
|
|||
def new
|
||||
@tracker ||= Tracker.new(params[:tracker])
|
||||
@trackers = Tracker.find :all, :order => 'position'
|
||||
@projects = Project.find(:all)
|
||||
@projects = Project.all
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -57,7 +57,7 @@ class TrackersController < ApplicationController
|
|||
|
||||
def edit
|
||||
@tracker ||= Tracker.find(params[:id])
|
||||
@projects = Project.find(:all)
|
||||
@projects = Project.all
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -83,7 +83,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def new
|
||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@auth_sources = AuthSource.all
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -112,7 +112,7 @@ class UsersController < ApplicationController
|
|||
format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
|
||||
end
|
||||
else
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@auth_sources = AuthSource.all
|
||||
# Clear password input
|
||||
@user.password = @user.password_confirmation = nil
|
||||
|
||||
|
@ -124,7 +124,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@auth_sources = AuthSource.all
|
||||
@membership ||= Member.new
|
||||
end
|
||||
|
||||
|
@ -159,7 +159,7 @@ class UsersController < ApplicationController
|
|||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@auth_sources = AuthSource.all
|
||||
@membership ||= Member.new
|
||||
# Clear password input
|
||||
@user.password = @user.password_confirmation = nil
|
||||
|
|
|
@ -31,7 +31,7 @@ class VersionsController < ApplicationController
|
|||
def index
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@trackers = @project.trackers.find(:all, :order => 'position')
|
||||
@trackers = @project.trackers.sorted.all
|
||||
retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?})
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id]
|
||||
|
@ -64,9 +64,10 @@ class VersionsController < ApplicationController
|
|||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@issues = @version.fixed_issues.visible.find(:all,
|
||||
:include => [:status, :tracker, :priority],
|
||||
:order => "#{Tracker.table_name}.position, #{Issue.table_name}.id")
|
||||
@issues = @version.fixed_issues.visible.
|
||||
includes(:status, :tracker, :priority).
|
||||
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
|
||||
all
|
||||
}
|
||||
format.api
|
||||
end
|
||||
|
|
|
@ -64,7 +64,7 @@ class WatchersController < ApplicationController
|
|||
end
|
||||
|
||||
def autocomplete_for_user
|
||||
@users = User.active.like(params[:q]).find(:all, :limit => 100)
|
||||
@users = User.active.like(params[:q]).limit(100).all
|
||||
if @watched
|
||||
@users -= @watched.watcher_users
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue