lib/shamu/json_api/relationship_builder.rb in shamu-0.0.4 vs lib/shamu/json_api/relationship_builder.rb in shamu-0.0.5
- old
+ new
@@ -4,13 +4,27 @@
module JsonApi
# Build a relationship from one resource to another.
class RelationshipBuilder < BaseBuilder
+
# (see Context#include_resource)
- def include_resource( resource, serializer = nil, &block )
- context.include_resource resource, serializer, &block
+ def include_resource( resource, presenter = nil, &block )
+ context.include_resource resource, presenter, &block
end
+ include BuilderMethods::Identifier
+
+ # Write a resource linkage info.
+ #
+ # @param [String] type of the resource.
+ # @param [Object] id of the resource.
+ # @return [void]
+ def identifier( type, id = nil )
+ output[:data] ||= {}
+ output[:data][:type] = @type = type.to_s
+ output[:data][:id] = id.to_s
+ self
+ end
end
end
end
\ No newline at end of file