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

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

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 65

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