mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Object.const_get differs on 2.0 and 2.1.2. So rescue from NameError
This commit is contained in:
parent
b4a313e6d8
commit
139609355f
@ -80,8 +80,10 @@ module ActiveModel
|
|||||||
adapter_class = case config.adapter
|
adapter_class = case config.adapter
|
||||||
when Symbol
|
when Symbol
|
||||||
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
|
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
|
||||||
if Object.const_defined?(class_name)
|
begin
|
||||||
Object.const_get(class_name)
|
Object.const_get(class_name)
|
||||||
|
rescue NameError
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
when Class
|
when Class
|
||||||
config.adapter
|
config.adapter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user