Sha256: 59883bfeffc352e0a5aab26d48ee62061eaf50e43cc3b071255bec0ec5ef7554

Contents?: true

Size: 393 Bytes

Versions: 8

Compression:

Stored size: 393 Bytes

Contents

module PhModel
  module Concerns

    # Adds support for defining callbacks around initialize
    module InitializeCallback
      extend ActiveSupport::Concern

      included do |other|
        other.define_model_callbacks :initialize
      end

      def initialize(attributes = nil, options = {})
        run_callbacks :initialize do
          super
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ph_model-1.2.0 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.1.3 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.1.2 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.1.1 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.1.0 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.0.2 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.0.1 lib/ph_model/concerns/initialize_callback.rb
ph_model-1.0.0 lib/ph_model/concerns/initialize_callback.rb