Sha256: c8819f3cf2fdb17d66c637bc47dda00fa15990eac177dca7bc30a7c0aaa42de1

Contents?: true

Size: 427 Bytes

Versions: 3

Compression:

Stored size: 427 Bytes

Contents

module ActiveUrl
  module Callbacks
    def create_with_callbacks
      result = create_without_callbacks
      run_callbacks(:after_save) unless result.blank?
      result
    end
    
    def self.included(base)
      base.class_eval do
        include ActiveSupport::Callbacks # Already included by ActiveRecord.
        alias_method_chain :create, :callbacks
        define_callbacks :after_save
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mholling-active_url-0.1.1 lib/active_url/callbacks.rb
mholling-active_url-0.1.2 lib/active_url/callbacks.rb
mholling-active_url-0.1.3 lib/active_url/callbacks.rb