mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Support conditions in link statements
This commit is contained in:
21
lib/active_model/serializer/link.rb
Normal file
21
lib/active_model/serializer/link.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'active_model/serializer/field'
|
||||
|
||||
module ActiveModel
|
||||
class Serializer
|
||||
# Holds all the data about an serializer link
|
||||
#
|
||||
# @example
|
||||
# class PostSerializer < ActiveModel::Serializer
|
||||
# link :callback, if: :internal? do
|
||||
# object.callback_link
|
||||
# end
|
||||
#
|
||||
# def internal?
|
||||
# instance_options[:internal] == true
|
||||
# end
|
||||
# end
|
||||
#
|
||||
class Link < Field
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user