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)
Devise uses the session storage that Rails is configured to. So it depends on which session storage you will use in your app, not on Devise. If you want to store the session data in the database, then yes, you need to tell Rails about that and run the Rails generator that creates the database table for you.
Our out-of-the box Devise setup is now working with Rails 7. Once again, if you'd like to refer to any of the code for this setup, or use the template wholesale for a new app, the code is available on GitHub, and you may also use it as a template repo to kick off your own Rails 7 devise projects.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With