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,142
  • 10
  • 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,666
  • 20
  • 23
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,948
  • 6
  • 44
  • 68
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
  • 383
  • 1
  • 6
  • 20