Module: ArJdbc::Oracle::Column
- Included in:
- ActiveRecord::ConnectionAdapters::OracleColumn
- Defined in:
- lib/arjdbc/oracle/column.rb
Overview
Defined Under Namespace
Modules: Cast
Instance Method Summary collapse
Instance Method Details
#primary=(value) ⇒ Object
17 18 19 20 |
# File 'lib/arjdbc/oracle/column.rb', line 17 def primary=(value) super @type = :integer if value && @sql_type =~ /^NUMBER$/i end |
#type_cast(value) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/arjdbc/oracle/column.rb', line 22 def type_cast(value) return nil if value.nil? case type when :datetime then self.class.string_to_time(value) when :timestamp then self.class.string_to_time(value) when :boolean then self.class.value_to_boolean(value) else super end end |
#type_cast_code(var_name) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/arjdbc/oracle/column.rb', line 33 def type_cast_code(var_name) case type when :datetime then "#{self.class.name}.string_to_time(#{var_name})" when :timestamp then "#{self.class.name}.string_to_time(#{var_name})" when :boolean then "#{self.class.name}.value_to_boolean(#{var_name})" else super end end |