mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Add NullAdapater
This commit is contained in:
@@ -3,6 +3,7 @@ module ActiveModel
|
||||
class Adapter
|
||||
extend ActiveSupport::Autoload
|
||||
autoload :SimpleAdapter
|
||||
autoload :NullAdapter
|
||||
|
||||
def initialize(serializer)
|
||||
@attributes = serializer.attributes
|
||||
|
||||
15
lib/active_model/serializer/adapter/null_adapter.rb
Normal file
15
lib/active_model/serializer/adapter/null_adapter.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
class Adapter
|
||||
class NullAdapter < Adapter
|
||||
def serializable_hash(options = {})
|
||||
{}
|
||||
end
|
||||
|
||||
def to_json(options = {})
|
||||
serializable_hash.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user