Module: ActiveRecord::ConnectionAdapters::OracleEnhancedProcedures::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#create_method_name_before_custom_methodsObject

:nodoc:



60
61
62
63
64
65
66
67
68
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 60

def create_method_name_before_custom_methods #:nodoc:
  if private_method_defined?(:create_without_timestamps) && defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::STRING.to_f >= 2.3
    :create_without_timestamps
  elsif private_method_defined?(:create_without_callbacks)
    :create_without_callbacks
  else
    :create
  end
end

#destroy_method_name_before_custom_methodsObject

:nodoc:



82
83
84
85
86
87
88
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 82

def destroy_method_name_before_custom_methods #:nodoc:
  if public_method_defined?(:destroy_without_callbacks)
    :destroy_without_callbacks
  else
    :destroy
  end
end

#set_create_method(&block) ⇒ Object

Specify custom create method which should be used instead of Rails generated INSERT statement. Provided block should return ID of new record. Example:

set_create_method do
  plsql.employees_pkg.create_employee(
    :p_first_name => first_name,
    :p_last_name => last_name,
    :p_employee_id => nil
  )[:p_employee_id]
end


28
29
30
31
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 28

def set_create_method(&block)
  include_with_custom_methods
  self.custom_create_method = block
end

#set_delete_method(&block) ⇒ Object

Specify custom delete method which should be used instead of Rails generated DELETE statement. Example:

set_delete_method do
  plsql.employees_pkg.delete_employee(
    :p_employee_id => id
  )
end


54
55
56
57
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 54

def set_delete_method(&block)
  include_with_custom_methods
  self.custom_delete_method = block
end

#set_update_method(&block) ⇒ Object

Specify custom update method which should be used instead of Rails generated UPDATE statement. Example:

set_update_method do
  plsql.employees_pkg.update_employee(
    :p_employee_id => id,
    :p_first_name => first_name,
    :p_last_name => last_name
  )
end


42
43
44
45
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 42

def set_update_method(&block)
  include_with_custom_methods
  self.custom_update_method = block
end

#update_method_name_before_custom_methodsObject

:nodoc:



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/active_record/connection_adapters/oracle_enhanced_procedures.rb', line 70

def update_method_name_before_custom_methods #:nodoc:
  if private_method_defined?(:update_without_dirty)
    :update_without_dirty
  elsif private_method_defined?(:update_without_timestamps) && defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::STRING.to_f >= 2.3
    :update_without_timestamps
  elsif private_method_defined?(:update_without_callbacks)
    :update_without_callbacks
  else
    :update
  end
end