Skip to content

Commit

Permalink
Check if model has skip tag in annotate_model_file
Browse files Browse the repository at this point in the history
Potentially addresses issue# ctran#167
Annotate_model_file is called automatically on all files in models directory and does not check if model contains SkipSchemaAnnotations tag.
  • Loading branch information
mafernando committed Mar 30, 2015
1 parent bc2662b commit ba5d1cc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/annotate/annotate_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def do_annotations(options={})

def annotate_model_file(annotated, file, header, options)
begin
return false if (/# -\*- SkipSchemaAnnotations.*/ =~ (File.exist?(file) ? File.read(file) : '') )
klass = get_model_class(file)
if klass && klass < ActiveRecord::Base && !klass.abstract_class? && klass.table_exists?
if annotate(klass, file, header, options)
Expand Down

1 comment on commit ba5d1cc

@ctran
Copy link

@ctran ctran commented on ba5d1cc Apr 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a check for SkipSchemaAnnotations in annotate_one_file. Is there a reason to duplicate in here at the higher level?

Please sign in to comment.