Skip to content

Commit 92190ef

Browse files
committed
Coerce class to string for comparison
Fixes ctran#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).
1 parent d847673 commit 92190ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/annotate/annotate_models.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def get_loaded_model(model_path)
399399
c.ancestors.respond_to?(:include?) and # to fix FactoryGirl bug, see https://github.com/ctran/annotate_models/pull/82
400400
c.ancestors.include?(ActiveRecord::Base)
401401
end.
402-
detect { |c| ActiveSupport::Inflector.underscore(c) == model_path }
402+
detect { |c| ActiveSupport::Inflector.underscore(c.to_s) == model_path }
403403
end
404404
end
405405

0 commit comments

Comments
 (0)