Skip to content

Commit 75e4bfa

Browse files
committed
Merge pull request #85 from djreimer/master
JRuby ObjectSpace compatibility fix
2 parents 26f3d91 + 83cacd7 commit 75e4bfa

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/annotate/annotate_models.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,8 @@ def get_model_class(file)
316316

317317
# Retrieve loaded model class by path to the file where it's supposed to be defined.
318318
def get_loaded_model(model_path)
319-
ObjectSpace.each_object.
320-
select { |c|
321-
Class === c and # note: we use === to avoid a bug in activesupport 2.3.14 OptionMerger vs. is_a?
322-
c.ancestors.include?(ActiveRecord::Base)
323-
}.
319+
ObjectSpace.each_object(::Class).
320+
select { |c| c.ancestors.include?(ActiveRecord::Base) }.
324321
detect { |c| ActiveSupport::Inflector.underscore(c) == model_path }
325322
end
326323

0 commit comments

Comments
 (0)