Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Annotation position defaulted to 'before'. Bugfix: annotate_models.ra…

…ke uses string instead of symbol.
  • Loading branch information...
commit 449bd7f1604fc087bf07e1b2e2787deaeabcd5d9 1 parent 0325656
@davidxia davidxia authored
View
6 lib/annotate/annotate_models.rb
@@ -145,9 +145,9 @@ def annotate_one_file(file_name, info_block, options={})
# But, if there *was* no old schema info, we simply need to insert it
if new_content == old_content
old_content.sub!(encoding, '')
- new_content = options[:position] == 'before' ?
- (encoding_header + info_block + old_content) :
- (encoding_header + (old_content =~ /\n$/ ? old_content : old_content + '\n') + info_block)
+ new_content = options[:position] == 'after' ?
+ (encoding_header + (old_content =~ /\n$/ ? old_content : old_content + '\n') + info_block) :
+ (encoding_header + info_block + old_content)
end
File.open(file_name, "wb") { |f| f.puts new_content }
View
4 lib/tasks/annotate_models.rake
@@ -5,8 +5,8 @@ task :annotate_models => :environment do
true_re = /(true|t|yes|y|1)$/i
options={}
- options[:position_in_class] = ENV['position_in_class'] || ENV['position'] || :before
- options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position'] || :before
+ options[:position_in_class] = ENV['position_in_class'] || ENV['position'] || 'before'
+ options[:position_in_fixture] = ENV['position_in_fixture'] || ENV['position'] || 'before'
options[:show_indexes] = ENV['show_indexes'] =~ true_re
options[:simple_indexes] = ENV['simple_indexes'] =~ true_re
options[:model_dir] = ENV['model_dir']
Please sign in to comment.
Something went wrong with that request. Please try again.