Permalink
Browse files

Fixed bug where a numeric column has scale as nil but being considere…

…d DECIMAL
  • Loading branch information...
1 parent c06c90b commit 4f7a3b66b4d7a67b50b3bd8ec03782d435bf2fde @CoryFoy committed Apr 27, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/active_record/connection_adapters/oracle_enhanced_column.rb
@@ -62,13 +62,18 @@ def comment
private
+ def scale_present?(field_type)
+ scale = extract_scale(field_type)
+ return scale.nil? || scale == 0
+ end
+
def simplified_type(field_type)
forced_column_type ||
case field_type
when /decimal|numeric|number/i
if OracleEnhancedAdapter.emulate_booleans && field_type == 'NUMBER(1)'
:boolean
- elsif extract_scale(field_type) == 0 ||
+ elsif scale_present?(field_type) ||
# if column name is ID or ends with _ID
OracleEnhancedAdapter.emulate_integers_by_column_name && OracleEnhancedAdapter.is_integer_column?(name, table_name)
:integer

0 comments on commit 4f7a3b6

Please sign in to comment.