Commit 5286f96b by Jon Frisby

Merge remote-tracking branch 'prophotos/custom_types_compatibility'

Conflicts: lib/annotate/annotate_models.rb
parents 06ebbd19 217fc9c5
...@@ -60,7 +60,7 @@ module AnnotateModels ...@@ -60,7 +60,7 @@ module AnnotateModels
attrs << "not null" unless col.null attrs << "not null" unless col.null
attrs << "primary key" if col.name == klass.primary_key attrs << "primary key" if col.name == klass.primary_key
col_type = col.type.to_s col_type = (col.type || col.sql_type).to_s
if col_type == "decimal" if col_type == "decimal"
col_type << "(#{col.precision}, #{col.scale})" col_type << "(#{col.precision}, #{col.scale})"
else else
...@@ -148,7 +148,7 @@ module AnnotateModels ...@@ -148,7 +148,7 @@ module AnnotateModels
if new_content == old_content if new_content == old_content
old_content.sub!(encoding, '') old_content.sub!(encoding, '')
new_content = options[:position] == 'after' ? new_content = options[:position] == 'after' ?
(encoding_header + (old_content =~ /\n$/ ? old_content : old_content + '\n') + info_block) : (encoding_header + (old_content.rstrip + "\n\n" + info_block)) :
(encoding_header + info_block + old_content) (encoding_header + info_block + old_content)
end 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