aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 00:00:52 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-04 00:00:52 -0300
commit2d9b9fb5b5f6015e66d3ad5cb96bc1ba117fd626 (patch)
tree386dcf7a78a7d5619819216f1bbe92c32ec4056c /activerecord
parente54d275023023347a325801fa25c18ac410a18ea (diff)
parent299e5f9c5758866ba4e580349da323fdda22c670 (diff)
downloadrails-2d9b9fb5b5f6015e66d3ad5cb96bc1ba117fd626.tar.gz
rails-2d9b9fb5b5f6015e66d3ad5cb96bc1ba117fd626.tar.bz2
rails-2d9b9fb5b5f6015e66d3ad5cb96bc1ba117fd626.zip
Merge pull request #18319 from kamipo/sql_type_has_been_determined
`sql_type` has been determined already when quoting defaults
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
index 18ff869ea6..db20b60d60 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
@@ -28,8 +28,8 @@ module ActiveRecord
end
def visit_ColumnDefinition(o)
- sql_type = type_to_sql(o.type, o.limit, o.precision, o.scale)
- column_sql = "#{quote_column_name(o.name)} #{sql_type}"
+ o.sql_type = type_to_sql(o.type, o.limit, o.precision, o.scale)
+ column_sql = "#{quote_column_name(o.name)} #{o.sql_type}"
add_column_options!(column_sql, column_options(o)) unless o.type == :primary_key
column_sql
end
@@ -98,9 +98,7 @@ module ActiveRecord
end
def quote_default_expression(value, column)
- column.sql_type ||= type_to_sql(column.type, column.limit, column.precision, column.scale)
value = type_for_column(column).type_cast_for_database(value)
-
@conn.quote(value)
end