简体   繁体   中英

Rails devise Sessions Controller

In devise, many of the pages that teach how to accomplish certain things require editing a sessions controller. I set up devise using this https://github.com/fortuity/rails3-subdomain-devise/wiki/Tutorial-(Walkthrough) It didn't go over making a sessions controller. How do I make one. (If it's really easy i'm sorry, just give me the few simple steps)

Create your Sessions Controller with rails g controller MySessions . Then inside of your controller change it from inheriting from ApplicationController to the Devise Controller like so:

class MySessionsController < Devise::SessionsController

#your session logic here

end

Any of the logic within that controller that you want to override you can override by calling that method and inserting your own logic. For the list of what's in that controller, you can view the code on their Github page. If you do not wish to override their methods you can either leave them out, or just call super.

def new
  super
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM