Sha256: d5b0cc5b8edf8a44f1af994c775911ec4f950a553f82a8f6efb00b8df1e852cc

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

##
# Obsolescing 是废弃。
# #reason 是原因。
# #obsolesced 是被废弃的对象。
# #obsolescence_code 是废弃代码,OBSL 表示废弃, RCVR 表示恢复。

class Unidom::Action::Obsolescing < Unidom::Action::ApplicationRecord

  self.table_name = 'unidom_obsolescings'

  include Unidom::Common::Concerns::ModelExtension
  include ProgneTapera::EnumCode
  include Unidom::Action::Concerns::AsCaused

  belongs_to :obsolescer_visitor, polymorphic: true
  belongs_to :obsolescer_party,   polymorphic: true
  belongs_to :obsolesced,         polymorphic: true

  scope :obsolesced_via, ->(obsolescer_visitor) { where obsolescer_visitor: obsolescer_visitor }
  scope :obsolesced_by,  ->(obsolescer_party)   { where obsolescer_party:   obsolescer_party   }
  scope :obsolesced_is,  ->(obsolesced)         { where obsolesced:         obsolesced         }

  code :obsolescence, Unidom::Action::Obsolescence

  def self.obsolesce!(obsolesced: nil, obsolescer_visitor: nil, obsolescer_party: nil, reason: nil, obsolescence_code: 'OBSL', opened_at: Time.now)
    create! obsolesced: obsolesced, obsolescer_visitor: obsolescer_visitor, obsolescer_party: obsolescer_party, reason: reason, obsolescence_code: obsolescence_code, opened_at: opened_at
  end

end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Action::Obsolescing'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
unidom-action-2.0 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.18 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.17 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.16 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.15 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.13 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.14 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.12 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.11 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.10 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.9 app/models/unidom/action/obsolescing.rb
unidom-action-1.17.8 app/models/unidom/action/obsolescing.rb