Base progress
This commit is contained in:
@@ -3,8 +3,8 @@ module Qwaiter::SupplierBaseSerializer
|
||||
include JSONAPI::Serializer
|
||||
included do
|
||||
class_attribute :related_link_for_attributes
|
||||
attribute :created_at
|
||||
attribute :updated_at
|
||||
timestamp_attribute :created_at
|
||||
timestamp_attribute :updated_at
|
||||
end
|
||||
|
||||
def base_url
|
||||
@@ -25,6 +25,7 @@ module Qwaiter::SupplierBaseSerializer
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def relationship_self_link(attribute_name)
|
||||
end
|
||||
|
||||
@@ -35,6 +36,13 @@ module Qwaiter::SupplierBaseSerializer
|
||||
end
|
||||
end
|
||||
|
||||
def timestamp_attribute(attr)
|
||||
attribute attr do
|
||||
return unless timestamp = object.public_send(attr)
|
||||
timestamp.iso8601
|
||||
end
|
||||
end
|
||||
|
||||
def related_link_for(*attributes)
|
||||
self.related_link_for_attributes = attributes
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user