0

I'm trying to work out how devise controls sign outs in a rails 3 app. I look at the routes for destroy session and it's

destroy_hr_partner_session GET    /hr_partners/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}

However, I cannot find a devise controller, or a session controller for that matter.

Clearly I;m missing something, can someone explain how this works?

Specifically, I need to customise the redirect after a session is destroyed

G

Gareth Burrows
  • 1,072
  • 8
  • 22

3 Answers3

0

It's not super obvious, but the controller is inside the devise gem. When you call devise_for in your routes.rb it sets those paths up for you.

For reference, here are the built-in controllers: https://github.com/plataformatec/devise/tree/master/app/controllers/devise

bratsche
  • 2,626
  • 18
  • 21
0

As explained on the devise github page, to configure controllers you can create a controller that extends the devise ones and then override the functionality. Then tell your devise route to use your new controller (devise_for :users, controllers: { sessions: "my_sessions" })

To see what the base functionality is, explore the source.

Matt
  • 13,577
  • 6
  • 43
  • 67
0

Devise already has a controlller compiled in the gem, but if you want to override it, then you can just create a controller. For more information, please have a look at this:

Override devise registrations controller

Community
  • 1
  • 1
Ahmed Reza Siddique
  • 345
  • 1
  • 6
  • 19