Sha256: 4f56bcf555e02c21358283dc0c2187315b41ab8b0ccffecc4cb690a171d0adaa

Contents?: true

Size: 447 Bytes

Versions: 23

Compression:

Stored size: 447 Bytes

Contents

module EnjuCirculation
  module EnjuWithdraw
    extend ActiveSupport::Concern

    included do
      before_save :withdraw!, on: :create
    end

    def withdraw!
      circulation_status = CirculationStatus.where(name: 'Removed').first
      item.update_column(:circulation_status_id, circulation_status.id) if circulation_status
      item.use_restriction = UseRestriction.where(name: 'Not For Loan').first
      item.index!
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.beta.4 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.4.0.beta.3 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.6 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.4.0.beta.2 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.4.0.beta.1 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.5 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.4 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.3 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.2 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.1 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.0 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.0.rc.1 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.3.0.beta.1 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.5 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.4 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.3 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.2 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.1 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.0 app/models/concerns/enju_circulation/enju_withdraw.rb
enju_circulation-0.2.0.beta.4 app/models/concerns/enju_circulation/enju_withdraw.rb