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.10.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.9.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.8.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.7.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.6.4 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.6.3 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.6.2 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.6.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.6.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.5.3 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.5.2 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.5.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.5.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.4.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.3.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.2.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.1.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.1.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.0.2 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.0.1 lib/json_api_client/helpers/callbacks.rb