lib/active_model/serializer.rb in cheap_ams-0.10.8 vs lib/active_model/serializer.rb in cheap_ams-0.10.10

- old
+ new

@@ -8,10 +8,11 @@ autoload :ArraySerializer autoload :Adapter autoload :Lint autoload :Associations autoload :Fieldset + autoload :Utils include Configuration include Associations # Matches # "c:/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>'" @@ -92,22 +93,12 @@ else options.fetch(:serializer, get_serializer_for(resource.class)) end end + # @see ActiveModel::Serializer::Adapter.lookup def self.adapter - adapter_class = case config.adapter - when Symbol - ActiveModel::Serializer::Adapter.adapter_class(config.adapter) - when Class - config.adapter - end - unless adapter_class - valid_adapters = Adapter.constants.map { |klass| ":#{klass.to_s.downcase}" } - raise ArgumentError, "Unknown adapter: #{config.adapter}. Valid adapters are: #{valid_adapters}" - end - - adapter_class + ActiveModel::Serializer::Adapter.lookup(config.adapter) end def self.root_name name.demodulize.underscore.sub(/_serializer$/, '') if name end