Skip to content

Commit 4dcee10

Browse files
committed
Update annotate_models.rb
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.
1 parent bc2662b commit 4dcee10

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/annotate/annotate_models.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ def do_annotations(options={})
477477

478478
def annotate_model_file(annotated, file, header, options)
479479
begin
480+
old_content = File.read(file) # Check model file for SkipSchemaAnnotations
481+
return false if(old_content =~ /# -\*- SkipSchemaAnnotations.*\n/)
480482
klass = get_model_class(file)
481483
if klass && klass < ActiveRecord::Base && !klass.abstract_class? && klass.table_exists?
482484
if annotate(klass, file, header, options)

0 commit comments

Comments
 (0)