Commit 067ce522 by Ilya Vassilevsky Committed by Ilya Vassilevsky

Prefer SQL column type over normalized AR type

parent f3d9ad51
......@@ -140,7 +140,7 @@ module AnnotateModels
attrs << "not null" unless col.null
attrs << "primary key" if klass.primary_key && (klass.primary_key.is_a?(Array) ? klass.primary_key.collect{|c|c.to_sym}.include?(col.name.to_sym) : col.name.to_sym == klass.primary_key.to_sym)
col_type = (col.type || col.sql_type).to_s
col_type = (col.sql_type || col.type).to_s
if col_type == "decimal"
col_type << "(#{col.precision}, #{col.scale})"
elsif col_type != "spatial"
......
......@@ -28,7 +28,7 @@ describe AnnotateModels do
stubs = default_options.dup
stubs.merge!(options)
stubs.merge!(:name => name, :type => type)
stubs.merge!(:name => name, :sql_type => type, :type => type)
double("Column", stubs)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment