0

I have setup a blank app with devise and the routes look like so:

  devise_for :users

Since devise already set up the model, I used rails g scaffold_controller users to generate the controller.

(I think) the only thing missing now are the routes

How do I set these up? (I presume resources :users could overwrite / interfere with the routing devise sets up for us?)

stevec
  • 41,291
  • 27
  • 223
  • 311
  • I added `resources :users` and tried it, and it seems to work (new routes are created via `resources :users`, and the existing routes created don't appear to be interfered with). Any confirmation about this approach would still be greatly appreciated. – stevec Aug 19 '20 at 12:10
  • Devise does its own routes with `devise_for`, you don't need to add anything else to routes.rb unless you want to customize devise's behavior. Run `rails routes | grep user` and you'll see all the goodies devise makes with its own namespace. Routes you add for users will not interfere with devise, but nor will devise use them. – dbugger Aug 19 '20 at 12:33
  • @dbugger thanks very much for confirming. Also, I didn't know about `rails routes | grep user`, that's really cool! Using that, I see `/users/sign_out`, but when I navigate there, [`Couldn't find User with 'id'=sign_out`](https://stackoverflow.com/questions/22490555/couldnt-find-user-with-id-sign-out) although I'm not sure why – stevec Aug 19 '20 at 12:37
  • users/sign_out is a DELETE method, you just can't navigate there – dbugger Aug 19 '20 at 12:41
  • 1
    @dbugger thanks, I ended up removing `resources :users` altogether as it was causing other annoying conflicts (which I'm sure could be resolved, but not worth it in this case). Thanks for the help – stevec Aug 19 '20 at 14:15

0 Answers0