Object.const_get differs on 2.0 and 2.1.2. So rescue from NameError

This commit is contained in:
Tema Bolshakov 2014-08-29 13:01:01 +04:00
parent b4a313e6d8
commit 139609355f

View File

@ -80,8 +80,10 @@ module ActiveModel
adapter_class = case config.adapter
when Symbol
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
if Object.const_defined?(class_name)
begin
Object.const_get(class_name)
rescue NameError
nil
end
when Class
config.adapter