Module: ActiveRecord::ConnectionAdapters::OracleEnhancedProcedures::InstanceMethods

Defined in:
lib/active_record/connection_adapters/oracle_enhanced_procedures.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 39

def self.included(base)
  base.instance_eval do
    if private_instance_methods.include?('create_without_callbacks') || private_instance_methods.include?(:create_without_callbacks)
      alias_method :create_without_custom_method, :create_without_callbacks
      alias_method :create_without_callbacks, :create_with_custom_method
    else
      alias_method_chain :create, :custom_method
    end
    # insert after dirty checking in Rails 2.1
    # in Ruby 1.9 methods names are returned as symbols
    if private_instance_methods.include?('update_without_dirty') || private_instance_methods.include?(:update_without_dirty)
      alias_method :update_without_custom_method, :update_without_dirty
      alias_method :update_without_dirty, :update_with_custom_method
    elsif private_instance_methods.include?('update_without_callbacks') || private_instance_methods.include?(:update_without_callbacks)
      alias_method :update_without_custom_method, :update_without_callbacks
      alias_method :update_without_callbacks, :update_with_custom_method
    else
      alias_method_chain :update, :custom_method
    end
    private :create, :update
    if public_instance_methods.include?('destroy_without_callbacks') || public_instance_methods.include?(:destroy_without_callbacks)
      alias_method :destroy_without_custom_method, :destroy_without_callbacks
      alias_method :destroy_without_callbacks, :destroy_with_custom_method
    else
      alias_method_chain :destroy, :custom_method
    end
    public :destroy
  end
end