Sha256: bd1eacd0787fe0503c5cbec4333c09d3e5bf312c2fa907f9449541bba4a109d1

Contents?: true

Size: 583 Bytes

Versions: 12

Compression:

Stored size: 583 Bytes

Contents

module Superstore
  module Callbacks
    extend ActiveSupport::Concern

    included do
      extend ActiveModel::Callbacks
      include ActiveModel::Validations::Callbacks

      define_model_callbacks :save, :create, :update, :destroy
    end

    def destroy #:nodoc:
      run_callbacks(:destroy) { super }
    end

    private
      def write(*args) #:nodoc:
        run_callbacks(:save) { super }
      end

      def create #:nodoc:
        run_callbacks(:create) { super }
      end

      def update(*) #:nodoc:
        run_callbacks(:update) { super }
      end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
superstore-1.0.12 lib/superstore/callbacks.rb
superstore-1.0.11 lib/superstore/callbacks.rb
superstore-1.0.10 lib/superstore/callbacks.rb
superstore-1.0.9 lib/superstore/callbacks.rb
superstore-1.0.8 lib/superstore/callbacks.rb
superstore-1.0.7 lib/superstore/callbacks.rb
superstore-1.0.6 lib/superstore/callbacks.rb
superstore-1.0.5 lib/superstore/callbacks.rb
superstore-1.0.4 lib/superstore/callbacks.rb
superstore-1.0.3 lib/superstore/callbacks.rb
superstore-1.0.2 lib/superstore/callbacks.rb
superstore-1.0.0 lib/superstore/callbacks.rb