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.23.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.22.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.21.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.21.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.20.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.19.0 lib/json_api_client/helpers/callbacks.rb
carwow-json_api_client-1.19.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.18.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.17.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.17.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.16.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.16.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.15.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.14.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.14.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.13.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.12.2 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.12.1 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.12.0 lib/json_api_client/helpers/callbacks.rb
json_api_client-1.11.0 lib/json_api_client/helpers/callbacks.rb