Sha256: 42917d5b4f2efb1403adc2bd74b53e5d50cace0dbed0f4e6432e60f17c577656

Contents?: true

Size: 500 Bytes

Versions: 6

Compression:

Stored size: 500 Bytes

Contents

module Toy
  module Callbacks
    extend ActiveSupport::Concern
    include ActiveSupport::Callbacks

    included do
      extend ActiveModel::Callbacks
      define_model_callbacks :save, :create, :update, :destroy
    end

    def save(*)
      run_callbacks(:save) { super }
    end

    def destroy
      run_callbacks(:destroy) { super }
    end

    private

    def create
      run_callbacks(:create) { super }
    end

    def update
      run_callbacks(:update) { super }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
toystore-0.10.4 lib/toy/callbacks.rb
toystore-0.10.3 lib/toy/callbacks.rb
toystore-0.10.2 lib/toy/callbacks.rb
toystore-0.10.1 lib/toy/callbacks.rb
toystore-0.10.0 lib/toy/callbacks.rb
toystore-0.9.0 lib/toy/callbacks.rb