app/models/unidom/standard/standard.rb in unidom-standard-1.0.1 vs app/models/unidom/standard/standard.rb in unidom-standard-1.1
- old
+ new
@@ -10,17 +10,14 @@
class Unidom::Standard::Standard < ActiveRecord::Base
self.table_name = 'unidom_standards'
include Unidom::Common::Concerns::ModelExtension
+ include Unidom::Standard::Concerns::AsSourceStandard
+ include Unidom::Standard::Concerns::AsTargetStandard
validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
validates :number, presence: true, length: { in: 2..self.columns_hash['number'].limit }, uniqueness: true
scope :number_is, ->(number) { where number: number }
-
- has_many :target_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :source_id # as: :source
- has_many :target_standards, through: :target_associatings, source: :target
- has_many :source_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :target_id # as: :target
- has_many :source_standards, through: :source_associatings, source: :source
end