Im following http://jsonapi.org/format/#document-top-level
I notice the following end-point (route):
/articles/1/relationships/author
In Rails, how would this route be contstructed in routes.rb
?
resources :articles do
# What goes here?
# Should relationship be a namespace or other?
# I guess author can be defined as a collection, or just a simple get
end
relationships
doesn't need to have any of the 7 RESTFUL actions.
The route should be like following code snippets:
resources :articles do
resources :relationships, :only => [] do
collection do
get :author
end
end
end
This is how the route file should look like. Please let me know if any update needed.