Allow overriding the adapter with render option

Make it easy to use multiple adapters in an app.

use "adapter: false" to not use ams

make a test override config.adapter
This commit is contained in:
Gary Gordon
2014-11-04 15:36:52 -05:00
parent 08fbba9087
commit 5560b49098
8 changed files with 99 additions and 50 deletions

View File

@@ -90,8 +90,7 @@ module ActiveModel
def self.adapter
adapter_class = case config.adapter
when Symbol
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
class_name.safe_constantize
ActiveModel::Serializer::Adapter.adapter_class(config.adapter)
when Class
config.adapter
end