Tom Hammond
Tom Hammond

Reputation: 6090

Rails Non Standard Resource Route

I'd like to create a route that's like this:

https://example.com/appusers/1/check_for_updates.

It should basically be a resourced route so that I can do @appuser = Appuser.find(params[:id])

But I can't figure out how to list that in my routes file.

I've tried get 'appusers/:id/check_for_updates' but that throws an error.

Upvotes: 0

Views: 149

Answers (1)

Alex Kojin
Alex Kojin

Reputation: 5214

You can do it using :member

resources :appusers do
  get :check_for_updates, on: :member
end

Rails documentation

Upvotes: 1

Related Questions