diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 6352cd46e..fcc73a244 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -18,7 +18,7 @@ class BuildList < ActiveRecord::Base belongs_to :mass_build, counter_cache: true, touch: true has_many :items, class_name: '::BuildList::Item', dependent: :destroy has_many :packages, class_name: '::BuildList::Package', dependent: :destroy - has_many :source_packages, class_name: '::BuildList::Package', conditions: { package_type: 'source' } + has_many :source_packages, -> { where(package_type: 'source') }, class_name: '::BuildList::Package' UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage] RELEASE_UPDATE_TYPES = %w[bugfix security] diff --git a/app/models/hook.rb b/app/models/hook.rb index 5d2c16ec8..532538155 100644 --- a/app/models/hook.rb +++ b/app/models/hook.rb @@ -2,6 +2,7 @@ class Hook < ActiveRecord::Base include WebHooks include UrlHelper include Rails.application.routes.url_helpers + belongs_to :project before_validation :cleanup_data diff --git a/app/models/issue.rb b/app/models/issue.rb index e1c55d12e..f5a99cdea 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -10,7 +10,7 @@ class Issue < ActiveRecord::Base has_many :comments, as: :commentable, dependent: :destroy has_many :subscribes, as: :subscribeable, dependent: :destroy has_many :labelings, dependent: :destroy - has_many :labels, through: :labelings, uniq: true + has_many :labels, -> { uniq }, through: :labelings has_one :pull_request, dependent: :destroy validates :title, :body, :project_id, presence: true diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index 694bab016..94bf85bd0 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -1,5 +1,5 @@ class MassBuild < ActiveRecord::Base - belongs_to :build_for_platform, class_name: 'Platform', conditions: {platform_type: 'main'} + belongs_to :build_for_platform, -> { where(platform_type: 'main') }, class_name: 'Platform' belongs_to :save_to_platform, class_name: 'Platform' belongs_to :user has_many :build_lists, dependent: :destroy