active_model_serializers/test/fixtures/poro.rb
Steve Klabnik 1ea83c8bee Implement a NullAdapter.
This adapter basically doesn't do anything, and just serializes
the attributes into plain old JSON.
2014-07-09 16:51:30 -04:00

21 lines
330 B
Ruby

class Model
def initialize(hash={})
@attributes = hash
end
def read_attribute_for_serialization(name)
if name == :id || name == 'id'
object_id
else
@attributes[name]
end
end
end
class Profile < Model
end
class ProfileSerializer < ActiveModel::Serializer
attributes :name, :description
end