We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75e4bfa commit 076e778Copy full SHA for 076e778
lib/annotate/annotate_models.rb
@@ -317,7 +317,11 @@ def get_model_class(file)
317
# Retrieve loaded model class by path to the file where it's supposed to be defined.
318
def get_loaded_model(model_path)
319
ObjectSpace.each_object(::Class).
320
- select { |c| c.ancestors.include?(ActiveRecord::Base) }.
+ select do |c|
321
+ Class === c and # note: we use === to avoid a bug in activesupport 2.3.14 OptionMerger vs. is_a?
322
+ c.ancestors.respond_to?(:include?) and # to fix FactoryGirl bug, see https://github.com/ctran/annotate_models/pull/82
323
+ c.ancestors.include?(ActiveRecord::Base)
324
+ end.
325
detect { |c| ActiveSupport::Inflector.underscore(c) == model_path }
326
end
327
0 commit comments