我知道 session_store 已从 Rails 4 中删除。
所以我尝试安装它,但有一些错误:
宝石文件
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'activerecord-session_store', github: 'rails/activerecord-session_store', plataform: :mri
安慰
捆绑安装C:\Sites\rails-estudo-blog>bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using sqlite3 (1.3.8)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Sites\rails-estudo-blog>
尝试安装 gem
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
尝试创建会话存储迁移
C:\Sites\rails-estudo-blog>rails generate active_record:session_migration
Could not find generator active_record:session_migration.
C:\Sites\rails-estudo-blog>
资讯
- 导轨 4.0
- 红宝石 2.0
- Windows 7 x64 专业版
怎么了?我遵循存储库的所有步骤:https ://github.com/rails/activerecord-session_store
作品!
我重写了文件,并且可以工作(我不知道问题所在),但是我还有另一个问题(我使用代理)。
$ bundle install
Fetching git://github.com/rails/activerecord-session_store.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No error
Git error: command `git clone
"git://github.com/rails/activerecord-session_store.git"
"c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/cache/bundler/git/activerecord-session_store-cf0cfe22b7614cc4fcd416e139ff2bd62ebd6f1d"
--bare --no-hardlinks` in directory c:/Sites/rails-estudo-blog has failed.
解决了
我可以解决问题将网址更改为:
gem 'activerecord-session_store', git: 'https://github.com/rails/activerecord-session_store'
因此,我将github更改为git并放入我想要的整个 url。