app/models/unidom/action/concerns/as_obsolesced.rb in unidom-action-1.17.9 vs app/models/unidom/action/concerns/as_obsolesced.rb in unidom-action-1.17.10

- old
+ new

@@ -1,14 +1,19 @@ module Unidom::Action::Concerns::AsObsolesced - extend ActiveSupport::Concern + extend ActiveSupport::Concern + include Unidom::Common::Concerns::ArgumentValidation included do |includer| has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced def is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now) + + assert_present! :obsolescence_code, obsolescence_code + obsolescings.create! obsolescence_code: 'OBSL', obsolescer_visitor: via, obsolescer_party: by, reason: due_to, opened_at: at + end def is_obsolesced?(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now) query = obsolescings query = query.obsolescence_coded_as obsolescence_code if obsolescence_code.present?