mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Add DSL for urls
This commit is contained in:
3
test/fixtures/poro.rb
vendored
3
test/fixtures/poro.rb
vendored
@@ -31,6 +31,8 @@ end
|
||||
|
||||
class ProfileSerializer < ActiveModel::Serializer
|
||||
attributes :name, :description
|
||||
|
||||
urls :posts, :comments
|
||||
end
|
||||
|
||||
Post = Class.new(Model)
|
||||
@@ -40,6 +42,7 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :title, :body, :id
|
||||
|
||||
has_many :comments
|
||||
url :comments
|
||||
end
|
||||
|
||||
CommentSerializer = Class.new(ActiveModel::Serializer) do
|
||||
|
||||
Reference in New Issue
Block a user