active_model_serializers/lib/active_model/serializer/adapter/simple_adapter.rb
2014-08-27 09:15:07 +04:00

18 lines
383 B
Ruby

module ActiveModel
class Serializer
class Adapter
class SimpleAdapter < Adapter
def serializable_hash(options = {})
serializer.attributes.each_with_object({}) do |(attr, value), h|
h[attr] = value
end
end
def to_json(options={})
serializable_hash(options).to_json
end
end
end
end
end