Commit ddfba1f7 by Cuong Tran

Merge pull request #32 from JackDanger/master

Fixed that schema kept prepending additional newlines
parents 0076e085 1d58ea1b
......@@ -133,7 +133,9 @@ module AnnotateModels
new_content = old_content.sub(/^# #{COMPAT_PREFIX}.*?\n(#.*\n)*\n/, info_block)
# But, if there *was* no old schema info, we simply need to insert it
if new_content == old_content
new_content = options[:position] == 'before' ? (info_block + old_content) : (old_content + "\n" + info_block)
new_content = options[:position] == 'before' ?
(info_block + old_content) :
((old_content =~ /\n$/ ? old_content : old_content + '\n') + info_block)
end
File.open(file_name, "wb") { |f| f.puts new_content }
......
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