This commit is contained in:
2015-09-05 14:14:28 +02:00
parent 7336585416
commit e2e883df1d
24 changed files with 62 additions and 44 deletions
+17 -9
View File
@@ -1,9 +1,10 @@
class Qwaiter::UserBaseSerializer
module Qwaiter::UserBaseSerializer
extend ActiveSupport::Concern
include JSONAPI::Serializer
class_attribute :related_link_for
def self.related_link_for(*attributes)
self.related_link_for = attributes
included do
class_attribute :related_link_for_attributes
attribute :created_at
attribute :updated_at
end
def base_url
@@ -22,15 +23,22 @@ class Qwaiter::UserBaseSerializer
#alias_method :default_relationship_related_link, :relationship_related_link
def relationship_related_link(attribute_name)
super if related_link_for.include?(attribute_name)
#super if related_link_for_attributes.include?(attribute_name)
super
end
def relationship_self_link(attribute_name)
end
def self.attributes(*attrs)
attrs.each do |attr|
attribute attr
module ClassMethods
def attributes(*attrs)
attrs.each do |attr|
attribute attr
end
end
def related_link_for(*attributes)
self.related_link_for_attributes = attributes
end
end
end