test/fixtures/poro.rb in active_model_serializers-0.10.0 vs test/fixtures/poro.rb in active_model_serializers-0.10.1
- old
+ new
@@ -134,14 +134,15 @@
has_many :roles
has_one :bio
end
RoleSerializer = Class.new(ActiveModel::Serializer) do
- cache only: [:name], skip_digest: true
- attributes :id, :name, :description, :slug
+ cache only: [:name, :slug], skip_digest: true
+ attributes :id, :name, :description
+ attribute :friendly_id, key: :slug
- def slug
+ def friendly_id
"#{object.name}-#{object.id}"
end
belongs_to :author
end
@@ -151,13 +152,13 @@
belongs_to :likeable
end
LocationSerializer = Class.new(ActiveModel::Serializer) do
- cache only: [:place], skip_digest: true
+ cache only: [:address], skip_digest: true
attributes :id, :lat, :lng
- belongs_to :place
+ belongs_to :place, key: :address
def place
'Nowhere'
end
end