Skip to content

Commit

Permalink
Fix collection override
Browse files Browse the repository at this point in the history
To fix hrefs in base controller abstraction land that doesn't have
concrete controllers/serializers for exceptions, we've 'normalized'
hrefs the best we could by deterministically giving an href based on the
request that prefers to be nested when possible - but are now screwed
because it's actually determined by what you can and can't do with
nested collections in the interface.

So, this does the same sort of hacky override that was here, just
without the misleading helper that was present before by constructing
our own URL deliberately.
  • Loading branch information
chrisarcand committed Dec 20, 2017
1 parent beeae8c commit eaec60d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/base_controller/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def add_actions(json, aspecs, type)
def expand_resource_custom_actions(resource, json, type, physical_attrs)
return unless render_actions(physical_attrs) && collection_config.custom_actions?(type)

href = @req.subcollection.present? ? collection_href(@req.subcollection, resource.id) : json.attributes!["href"]
href = @req.subcollection.present? ? normalize_url("#{@req.subcollection}/#{resource.id}") : json.attributes!["href"]
json.actions do |js|
resource_custom_action_names(resource).each do |action|
add_child js, "name" => action, "method" => :post, "href" => href
Expand Down

0 comments on commit eaec60d

Please sign in to comment.