Module: ActiveRecord::OracleEnhancedProcedures::ClassMethods

Defined in:
lib/active_record/connection_adapters/oracle_enhanced/procedures.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#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


48
49
50
# File 'lib/active_record/connection_adapters/oracle_enhanced/procedures.rb', line 48

def set_create_method(&block)
  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


72
73
74
# File 'lib/active_record/connection_adapters/oracle_enhanced/procedures.rb', line 72

def set_delete_method(&block)
  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


61
62
63
# File 'lib/active_record/connection_adapters/oracle_enhanced/procedures.rb', line 61

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