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
    member do
        get 'result'
    end
    resources :respondents, only: [:new, :create], :
new_respondent_for_assessment, to: :create_respondent_for_assessment do
      collection do
        post "invite", to: :invite_all
        get "invite", to: :new_invite
      end
    end
  end

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.

Thanks,
Jeff

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to