diff --git a/app/models/build_list/item.rb b/app/models/build_list/item.rb index 470fbf491..896f36592 100644 --- a/app/models/build_list/item.rb +++ b/app/models/build_list/item.rb @@ -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 diff --git a/app/models/build_list/package.rb b/app/models/build_list/package.rb index 2b4e012b6..1c10fb531 100644 --- a/app/models/build_list/package.rb +++ b/app/models/build_list/package.rb @@ -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