[issue #620] Removed scope from BuildList::Package && small refactoring.

This commit is contained in:
George Vinogradov 2012-08-31 21:47:52 +04:00
parent 16e101cc05
commit decd4bf293
3 changed files with 2 additions and 3 deletions

View File

@ -8,7 +8,7 @@ class Platforms::MaintainersController < ApplicationController
@maintainers = BuildList::Package.actual.by_platform(@platform) @maintainers = BuildList::Package.actual.by_platform(@platform)
.order('lower(name) ASC, length(name) ASC') .order('lower(name) ASC, length(name) ASC')
.includes(:project) .includes(:project)
@maintainers = @maintainers.find_by_name(params[:q]) if params[:q].present? @maintainers = @maintainers.where('name ILIKE ?', "%#{params[:q]}%") if params[:q].present?
@maintainers = @maintainers.paginate(:page => params[:page]) @maintainers = @maintainers.paginate(:page => params[:page])
end end

View File

@ -39,7 +39,7 @@ class Projects::ProjectsController < Projects::BaseController
end end
def update def update
params[:project].delete(:maintainer_id) unless params[:project][:maintainer_id].present? params[:project].delete(:maintainer_id) if params[:project][:maintainer_id].blank?
if @project.update_attributes(params[:project]) if @project.update_attributes(params[:project])
flash[:notice] = t('flash.project.saved') flash[:notice] = t('flash.project.saved')
redirect_to @project redirect_to @project

View File

@ -16,7 +16,6 @@ class BuildList::Package < ActiveRecord::Base
scope :actual, where(:actual => true) scope :actual, where(:actual => true)
scope :by_platform, lambda {|platform| where(:platform_id => platform) } scope :by_platform, lambda {|platform| where(:platform_id => platform) }
scope :by_name, lambda {|name| where(:name => name) } scope :by_name, lambda {|name| where(:name => name) }
scope :find_by_name, lambda {|name| where('name ILIKE ?', "%#{name}%") }
scope :by_package_type, lambda {|type| where(:package_type => type) } scope :by_package_type, lambda {|type| where(:package_type => type) }
def assignee def assignee