Sha256: 31b95057d7027d8e853ac084a213162860cf52229f76567b154b4c1997bfa38b

Contents?: true

Size: 498 Bytes

Versions: 43

Compression:

Stored size: 498 Bytes

Contents

module JsonApiClient
  module Helpers
    module Callbacks
      extend ActiveSupport::Concern

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

      def save
        run_callbacks :save do
          run_callbacks (persisted? ? :update : :create) do
            super
          end
        end
      end

      def destroy
        run_callbacks :destroy do
          super
        end
      end

    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
json_api_client-1.0.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.0.0.beta7 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.0.0.beta6 lib/json_api_client/helpers/callbacks.rb