From 92190ef1ad109a084ecdb6c3df208d9e56e068d3 Mon Sep 17 00:00:00 2001 From: Emil Kampp Date: Wed, 11 Jun 2014 20:43:57 +0200 Subject: [PATCH] Coerce class to string for comparison Fixes ctran/annotate_models#173, by ensuring that the model is coerced to a string before it's run through `ActiveSupport::Inflector.underscore`, which then correctly compares to the filename (which is a string already). --- lib/annotate/annotate_models.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/annotate/annotate_models.rb b/lib/annotate/annotate_models.rb index 3c5857021..9a88c55f0 100644 --- a/lib/annotate/annotate_models.rb +++ b/lib/annotate/annotate_models.rb @@ -399,7 +399,7 @@ def get_loaded_model(model_path) c.ancestors.respond_to?(:include?) and # to fix FactoryGirl bug, see https://github.com/ctran/annotate_models/pull/82 c.ancestors.include?(ActiveRecord::Base) end. - detect { |c| ActiveSupport::Inflector.underscore(c) == model_path } + detect { |c| ActiveSupport::Inflector.underscore(c.to_s) == model_path } end end