Ruby on RAILS4 Session database storage method

Source: Internet
Author: User

The internet is all about rake:db:sessions:create. But for the RAILS4 version, it doesn't work.

Here is my own operation for the RAILS4 version.


RAILS4 Session data Table creation: Please refer to this document: Http://www.cnblogs.com/heimirror/p/3536965.html.


1. Locate the project's Gemfile file to modify it:

Add Gem ' Activerecord-session_store '

Save exit, do not need the URL of the following GitHub

2. Execute under the project root path:

Rails Generate Active_record:session_migration

3. Modify the Config/initializers/session_store.rb file

Rails.application.config.session_store:active_record_store

Add this line and the rest can be dropped.

4. Execute the Database Migration command in command line mode: Rake db:migrate

You'll find a sesions table in your database.


Note here that the difference between 4 and previous versions is larger, and no longer rake db:sessions:create.



This article is from the "re-learn Java" blog, please be sure to keep this source http://3131854.blog.51cto.com/3121854/1558575

Ruby on RAILS4 Session database storage method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.