#977: update BuildList::Item and BuildList::Package models

This commit is contained in:
Vokhmin Alexey V 2013-02-28 19:34:38 +04:00
parent dc5af30a9a
commit 133210ae0e
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class BuildList::Item < ActiveRecord::Base
BuildList::BUILD_CANCELED => :build_canceled
}
scope :recent, order("level ASC, name ASC")
scope :recent, order("#{table_name}.level ASC, #{table_name}.name ASC")
def self.group_by_level
items = scoped({}).recent

View File

@ -13,14 +13,14 @@ class BuildList::Package < ActiveRecord::Base
validates :package_type, :inclusion => PACKAGE_TYPES
validates :sha1, :presence => true, :if => Proc.new { |p| p.build_list.new_core? }
default_scope order('lower(build_list_packages.name) ASC, length(build_list_packages.name) ASC')
default_scope order("lower(#{table_name}.name) ASC, length(#{table_name}.name) ASC")
# Fetches only actual (last publised) packages.
scope :actual, where(:actual => true)
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
scope :by_name, lambda {|name| where(:name => name) }
scope :by_package_type, lambda {|type| where(:package_type => type) }
scope :like_name, lambda {|name| where('build_list_packages.name ILIKE ?', "%#{name}%") if name.present?}
scope :like_name, lambda {|name| where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present?}
def assignee
project.maintainer