Commit c24f64c3 by Peter Boling Committed by Cuong Tran

Allow use of the fallback loading solution (#473)

LoadError does not descend from `StandardError` so the fallback loading is never invoked. ``` >> LoadError.ancestors => [LoadError, ScriptError, Exception, Object, Kernel, BasicObject] ```
parent 9f3e2b73
...@@ -613,7 +613,7 @@ module AnnotateModels ...@@ -613,7 +613,7 @@ module AnnotateModels
# Retrieve loaded model class by path to the file where it's supposed to be defined. # Retrieve loaded model class by path to the file where it's supposed to be defined.
def get_loaded_model(model_path) def get_loaded_model(model_path)
ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path)) ActiveSupport::Inflector.constantize(ActiveSupport::Inflector.camelize(model_path))
rescue rescue StandardError, LoadError
# Revert to the old way but it is not really robust # Revert to the old way but it is not really robust
ObjectSpace.each_object(::Class) ObjectSpace.each_object(::Class)
.select do |c| .select do |c|
......
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