app/models/unidom/standard/standard.rb in unidom-standard-0.1 vs app/models/unidom/standard/standard.rb in unidom-standard-0.2
- old
+ new
@@ -14,6 +14,13 @@
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
+
+ include Unidom::Common::Concerns::ModelExtension
+
end