我尝试从Rails 2.3.15升级到3.2.17
我做了bundle update
,并根据需要更改了控制器语法。
尝试启动服务器并且我收到以下错误,是否有人熟悉此操作?
>> bundle exec script/server
/opt/boxen/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.7.0/lib/bundler/rubygems_integration.rb:266:in `block in replace_gem': can't activate rails (= 2.3.15), already activated rails-3.2.17. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
from /Users/neo/src/myapp/config/boot.rb:60:in `load_rails_gem'
from /Users/neo/src/myapp/config/boot.rb:54:in `load_initializer'
from /Users/neo/src/myapp/config/boot.rb:38:in `run'
from /Users/neo/src/myapp/boot.rb:11:in `boot!'
from /Users/neo/src/myapp/config/boot.rb:114:in `<top (required)>'
from script/server:2:in `require'
from script/server:2:in `<main>'
我的Gemfile:
source "https://rubygems.org"
#ruby "1.8.7", :group => :staging
gem 'rails', '3.2.17'
gem 'rake', '0.9.2'
gem "aws-s3", :require => "aws/s3"
gem 'authlogic', '~> 2.1.1'
gem 'RedCloth', :require => "redcloth"
gem 'logging'
gem 'panda'
gem 'hoptoad_notifier'
gem 'fastercsv'
gem "comma", "~> 2.0" # specifying -v to add support to rails 2
gem 'pg'
gem 'cloudfront-signer'
gem 'newrelic_rpm'
gem 'thin'
group :development do
gem 'heroku'
gem 'taps'
gem 'sqlite3'
gem 'pry'
gem 'rdoc'
end
gem 'heroku_san'
group :test do
gem 'pg'
end
任何帮助将不胜感激!谢谢
编辑:
使用rails s
或bundle exec rails s / server
,我只会收到about rails消息,如下所示:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /opt/boxen/rbenv/versions/1.9.3-p545/bin/ruby
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL)
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
[--skip-bundle], [--no-skip-bundle] # Don't run bundle install
-G, [--skip-git], [--no-skip-git] # Skip Git ignores and keeps
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
-d, [--database=DATABASE] # Preconfigure for selected database .
.
.
答案 0 :(得分:2)
您应该使用
bundle exec rails server
编辑:以前在脚本目录中的所有内容现在都由rails命令管理。在升级时,我发现使用gemset将新宝石与旧宝石隔离起来要容易得多,因为往往需要来回切换,而新的rails命令将无法与旧版本完美搭配。
答案 1 :(得分:1)
Rails 3使用新命令语法启动服务器,控制台,脚手架等。
在rails 3 script/* got replaced by script/rails
中因此,您需要启动服务器,如:
rails s
OR
rails server