Rebased / updated @AKHarris' "custom links defined per resource"#571
Conversation
|
👍 @reidab thanks! Sorry I've been MIA. |
|
Another option here would be to make this more closely mirror the resource meta feature, by removing the e.g. class BookResource < JSONAPI::Resource
def custom_links(options)
{
raw: options[:serialzer].link_builder.self_link(self) + "/raw",
related: {
href: options[:serialzer].link_builder.self_link(self) + "/related",
meta: {
count: 10
}
}
}
end
end |
|
@reidab I started initially by implementing And then maybe the DSL should emerge from use cases (perhaps the These are just a few of my immediate thoughts. |
|
Okay, I took a stab at simplifying things down to an override of |
There was a problem hiding this comment.
These resources are not being used in the tests. Could you please remove?
You can run COVERAGE=true bundle exec rake test to make sure you're at 100% coverage.
|
ping @reidab. take it away 👏 |
…esource instance to build a custom url
…at takes a JSONAPI::Resource instance and a link_builder
0642f61 to
9ff1fd5
Compare
|
👍 Removed unused resources, verified 100% coverage, and rebased onto current master. |
…ined-per-resource Rebased / updated @akharris' "custom links defined per resource"
A quick attempt to resurrect @akharris' PR #486 😄
This branch rebases the changes from #486 onto the current master, fixing merge conflicts, and updates the
custom_linklambda to receiveResourceSerializer#custom_generation_options, per this comment.