Sha256: 84199a176464c3bad9ed5d4faaeb4c418ae611eaad4e23984ceca81cf9f2e6a0

Contents?: true

Size: 692 Bytes

Versions: 11

Compression:

Stored size: 692 Bytes

Contents

module EnjuCirculation
  module EnjuAccept
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def enju_circulation_accept_model
        include InstanceMethods
        before_save :accept!, on: :create
      end
    end

    module InstanceMethods
      def accept!
        circulation_status = CirculationStatus.where(name: 'Available On Shelf').first
        item.update_column(:circulation_status_id, circulation_status.id) if circulation_status
        use_restriction = UseRestriction.where(name: 'Limited Circulation, Normal Loan Period').first
        item.use_restriction = use_restriction if use_restriction
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
enju_circulation-0.1.2 lib/enju_circulation/accept.rb
enju_circulation-0.1.1 lib/enju_circulation/accept.rb
enju_circulation-0.1.0 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre49 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre48 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre47 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre46 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre45 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre44 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre43 lib/enju_circulation/accept.rb
enju_circulation-0.1.0.pre42 lib/enju_circulation/accept.rb