Commit 277f1713 by Rob Bevan

quick hack to prefix annotation with encoding (encoding: UTF-8)

parent 9c68c8c9
module AnnotateModels
class << self
UTF8 = "encoding: UTF-8"
# Annotate Models plugin use this header
COMPAT_PREFIX = "== Schema Info"
PREFIX = "== Schema Information"
......@@ -117,6 +119,7 @@ module AnnotateModels
def annotate_one_file(file_name, info_block, options={})
if File.exist?(file_name)
old_content = File.read(file_name)
old_content.sub!(/^# #{UTF8}.*?\n/, '')
# Ignore the Schema version line because it changes with each migration
header = Regexp.new(/(^# Table name:.*?\n(#.*\n)*\n)/)
......@@ -248,7 +251,7 @@ module AnnotateModels
end
end
header = PREFIX.dup
header = "#{UTF8.dup}\n# #{PREFIX.dup}"
if options[:include_version]
version = ActiveRecord::Migrator.current_version rescue 0
......
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