Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ The relationship methods (`relationship`, `has_one`, and `has_many`) support the
* `acts_as_set` - allows the entire set of related records to be replaced in one operation. Defaults to false if not set.
* `polymorphic` - set to true to identify relationships that are polymorphic.
* `relation_name` - the name of the relation to use on the model. A lambda may be provided which allows conditional selection of the relation based on the context.
* `always_include_linkage_data` - if set to true, the relationship includes linkage data. Defaults to false if not set.

`to_one` relationships support the additional option:
* `foreign_key_on` - defaults to `:self`. To indicate that the foreign key is on the related resource specify `:related`.
Expand Down
1 change: 1 addition & 0 deletions lib/jsonapi/resource_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def link_object_to_one(source, relationship, include_linkage)
end

def link_object_to_many(source, relationship, include_linkage)
include_linkage = include_linkage | relationship.always_include_linkage_data
link_object_hash = {}
link_object_hash[:links] = {}
link_object_hash[:links][:self] = self_link(source, relationship)
Expand Down