[#345] remove deprecations with association conditions

This commit is contained in:
Alexander Machehin 2014-03-11 18:39:57 +06:00
parent a559d7f918
commit f99211da9a
4 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class BuildList < ActiveRecord::Base
belongs_to :mass_build, counter_cache: true, touch: true belongs_to :mass_build, counter_cache: true, touch: true
has_many :items, class_name: '::BuildList::Item', dependent: :destroy has_many :items, class_name: '::BuildList::Item', dependent: :destroy
has_many :packages, class_name: '::BuildList::Package', 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] UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage]
RELEASE_UPDATE_TYPES = %w[bugfix security] RELEASE_UPDATE_TYPES = %w[bugfix security]

View File

@ -2,6 +2,7 @@ class Hook < ActiveRecord::Base
include WebHooks include WebHooks
include UrlHelper include UrlHelper
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
belongs_to :project belongs_to :project
before_validation :cleanup_data before_validation :cleanup_data

View File

@ -10,7 +10,7 @@ class Issue < ActiveRecord::Base
has_many :comments, as: :commentable, dependent: :destroy has_many :comments, as: :commentable, dependent: :destroy
has_many :subscribes, as: :subscribeable, dependent: :destroy has_many :subscribes, as: :subscribeable, dependent: :destroy
has_many :labelings, 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 has_one :pull_request, dependent: :destroy
validates :title, :body, :project_id, presence: true validates :title, :body, :project_id, presence: true

View File

@ -1,5 +1,5 @@
class MassBuild < ActiveRecord::Base 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 :save_to_platform, class_name: 'Platform'
belongs_to :user belongs_to :user
has_many :build_lists, dependent: :destroy has_many :build_lists, dependent: :destroy