From 4dcee10fd77fb2a7f55dfef408be6a1b657a7f21 Mon Sep 17 00:00:00 2001 From: Michael Fernando Date: Sun, 29 Mar 2015 16:03:35 -0500 Subject: [PATCH] Update annotate_models.rb Potentially addresses issue# https://github.com/ctran/annotate_models/issues/167 Annotate_model_file is called automatically on all files in models directory and does not check if model contains SkipSchemaAnnotations tag. --- lib/annotate/annotate_models.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 3786d221f..978e3785b 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -477,6 +477,8 @@ def do_annotations(options={}) def annotate_model_file(annotated, file, header, options) begin + old_content = File.read(file) # Check model file for SkipSchemaAnnotations + return false if(old_content =~ /# -\*- SkipSchemaAnnotations.*\n/) klass = get_model_class(file) if klass && klass < ActiveRecord::Base && !klass.abstract_class? && klass.table_exists? if annotate(klass, file, header, options)