Hi Rails Core Team,
I’ve noticed that you can set the controller method use by a route doing:
resources :assessments, only: [:create], to: :create_asessment_for_company
Is this unintended? If this is by design, how can I set the method for each action in the array? I tried something like the following, but it didn’t work.
resources :assessments do
resources :respondents, only: [:new, :create], :new_respondent_for_assessment, to: :create_respondent_for_assessment do
post “invite”, to: :invite_all
get “invite”, to: :new_invite
Is there a way to do this? I’ve looked through the rails guides and the ActiveDispatch docs and couldn’t see a way. Is this a feature, you’d accept a pull request for?
The reason why I’m trying to do this is my actions return JS and I need different JS to run depending on the context of the request aka. Is the respondent being edited in general, or is the action happening in the “scope” of the assessment. I’m trying to use the URL in what I understand is a RESTful way to identify a particular context.