You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This results in only one set of paths in the DiscussionsApi.ts:
// DO NOT MODIFY: This file was automatically generated by JsFromRoutes.import{definePathHelper}from'@js-from-routes/client'exportdefault{index: /* #__PURE__ */definePathHelper('get','/s/:section_slug/discussions'),create: /* #__PURE__ */definePathHelper('post','/s/:section_slug/discussions'),new: /* #__PURE__ */definePathHelper('get','/s/:section_slug/discussions/new'),edit: /* #__PURE__ */definePathHelper('get','/s/:section_slug/discussions/:id/edit'),show: /* #__PURE__ */definePathHelper('get','/s/:section_slug/discussions/:id'),update: /* #__PURE__ */definePathHelper('patch','/s/:section_slug/discussions/:id'),destroy: /* #__PURE__ */definePathHelper('delete','/s/:section_slug/discussions/:id'),}
So there is no way for me to distinguish between section_discussion_path and custom_section_discussion_path, since using DiscussionsApi.show.path({custom_section_slug}) would result in an error.
Is there a way around this?
Thanks!
The text was updated successfully, but these errors were encountered:
A workaround to disambiguate is to have two stub controllers, SectionDiscussionsController < DiscussionsController and CustomSectionDiscussionsController < DiscussionsController:
@ElMassimo Thanks for the reply and the workaround!
Regarding the information being available or not, something like js-routes does seem to manage to create a helper called customSectionsDiscussionsPath. So I guess the information is indeed available? I could be wrong though!
The workaround is helpful for now but having something like Section::ImagesController generate an ImagesApi does seem difficult to manage if the only solution is creating stub controllers.
bundle update js_from_routes
.Description 📖
In my routes.rb I have the following setup:
This results in only one set of paths in the
DiscussionsApi.ts
:So there is no way for me to distinguish between
section_discussion_path
andcustom_section_discussion_path
, since usingDiscussionsApi.show.path({custom_section_slug})
would result in an error.Is there a way around this?
Thanks!
The text was updated successfully, but these errors were encountered: