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
end
def show
- @attachments = @document.attachments.find(:all, :order => "created_on DESC")
+ @attachments = @document.attachments.all
end
def new
@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?
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
@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?)
private
def find_issue_statuses
- @statuses = IssueStatus.find(:all, :order => 'position')
+ @statuses = IssueStatus.sorted.all
end
end
@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? }
def new
@tracker ||= Tracker.new(params[:tracker])
@trackers = Tracker.find :all, :order => 'position'
- @projects = Project.find(:all)
+ @projects = Project.all
end
def create
def edit
@tracker ||= Tracker.find(params[:id])
- @projects = Project.find(:all)
+ @projects = Project.all
end
def update
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
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
end
def edit
- @auth_sources = AuthSource.find(:all)
+ @auth_sources = AuthSource.all
@membership ||= Member.new
end
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
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]
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
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