Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Annotation position defaulted to 'before'. Bugfix: annotate_models.rake uses string instead of symbol. #69

Merged
merged 1 commit into from

2 participants

@davidxia

No description provided.

@ctran ctran merged commit a43c08f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2012
  1. @davidxia

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

    davidxia authored
    …ke uses string instead of symbol.
This page is out of date. Refresh to see the latest.
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']
Something went wrong with that request. Please try again.