Commit 75e4bfa8 by Alex Chaffee

Merge pull request #85 from djreimer/master

JRuby ObjectSpace compatibility fix
parents 26f3d91e 83cacd72
......@@ -316,11 +316,8 @@ module AnnotateModels
# Retrieve loaded model class by path to the file where it's supposed to be defined.
def get_loaded_model(model_path)
ObjectSpace.each_object.
select { |c|
Class === c and # note: we use === to avoid a bug in activesupport 2.3.14 OptionMerger vs. is_a?
c.ancestors.include?(ActiveRecord::Base)
}.
ObjectSpace.each_object(::Class).
select { |c| c.ancestors.include?(ActiveRecord::Base) }.
detect { |c| ActiveSupport::Inflector.underscore(c) == model_path }
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment