Module: ActiveUrl::Callbacks

Defined in:
lib/active_url/callbacks.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/active_url/callbacks.rb', line 9

def self.included(base)
  base.class_eval do
    include ActiveSupport::Callbacks # Already included by ActiveRecord.
    alias_method_chain :save, :callbacks
    define_callbacks :after_save
  end
end

Instance Method Details

#save_with_callbacksObject



3
4
5
6
7
# File 'lib/active_url/callbacks.rb', line 3

def save_with_callbacks
  returning(save_without_callbacks) do |result|
    run_callbacks(:after_save) unless result.blank?
  end
end