Skip to content

Commit

Permalink
Merge pull request #231 from vassilevsky/sql-type-first
Browse files Browse the repository at this point in the history
Prefer SQL column type over normalized AR type
  • Loading branch information
ctran committed Apr 13, 2015
2 parents 06f38d8 + 067ce52 commit 8aa0be7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/annotate/annotate_models.rb
Expand Up @@ -140,7 +140,7 @@ def get_schema_info(klass, header, options = {})
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"
Expand Down
2 changes: 1 addition & 1 deletion spec/annotate/annotate_models_spec.rb
Expand Up @@ -45,7 +45,7 @@ def mock_column(name, type, options={})

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
Expand Down

0 comments on commit 8aa0be7

Please sign in to comment.