undefined局部变量或main:Object的方法`config'

时间:2013-12-03 15:10:21

标签: ruby-on-rails ruby-on-rails-3 bundler

我尝试将rails 2.3应用程序迁移到rails 3.13。随后我将我的gem配置转移到Gemfile并进行了Bundle安装。我已更新routes.rb以符合新格式。

但我无法启动我的应用程序。现在坚持了一段时间。无法弄清楚foll在哪里。错误来自。

这是我对Phushion Passenger的回溯。

0   rails_apps/gsnapweb/vendor/plugins/delayed_job/rails/init.rb    3   in `'
1   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb   251 in `require'
2   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb   251 in `block in require'
3   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb   236 in `load_dependency'
4   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb   251 in `require'
5   rails_apps/gsnapweb/vendor/plugins/delayed_job/init.rb  1   in `block in '
6   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/plugin.rb   82  in `eval'
7   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/plugin.rb   82  in `block in '
8   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb    30  in `instance_exec'
9   rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb    30  in `run'
10  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb    55  in `block in run_initializers'
11  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb    54  in `each'
12  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb    54  in `run_initializers'
13  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application.rb  136 in `initialize!'
14  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/railties-3.2.13/lib/rails/railtie/configurable.rb 30  in `method_missing'
15  rails_apps/gsnapweb/config/environment.rb   5   in `'
16  config.ru   3   in `require'
17  config.ru   3   in `block in'
18  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/rack-1.4.5/lib/rack/builder.rb    51  in `instance_eval'
19  rails_apps/gsnapweb/vendor/bundle/ruby/1.9.3/gems/rack-1.4.5/lib/rack/builder.rb    51  in `initialize'
20  config.ru   1   in `new'
21  config.ru   1   in `'

这是我的Gemfile。

1 source 'https://rubygems.org'
2
3 gem 'rails', '3.2.13'
4
5 # Bundle edge Rails instead:
6 # gem 'rails', :git => 'git://github.com/rails/rails.git'
7
8 gem 'mysql2'
9
10
11 # Gems used only for assets and not required
12 # in production environments by default.
13 group :assets do
14   gem 'sass-rails',   '~> 3.2.3'
15   gem 'coffee-rails', '~> 3.2.1'
16
17   # See https://github.com/sstephenson/execjs#readme for more supported runtimes
18   # gem 'therubyracer', :platforms => :ruby
19
20   gem 'uglifier', '>= 1.0.3'
21 end
22
23 gem 'will_paginate', '>=3.0.pre'
24 gem 'jquery-rails'
25 gem 'rack'
26 gem 'delayed_job_active_record'
27
28 # To use ActiveModel has_secure_password
29 # gem 'bcrypt-ruby', '~> 3.0.0'
30
31 # To use Jbuilder templates for JSON
32 # gem 'jbuilder'
33
34 # Use unicorn as the app server
35 # gem 'unicorn'
36
37 # Deploy with Capistrano
38 # gem 'capistrano'
39
40 # To use debugger
41 # gem 'debugger'

application.rb文件

require File.expand_path('../boot', __FILE__)
require 'rails/all'

+--  6 lines: if defined?(Bundler)----------------------------------------------------------------------------

module Gsnapweb
class Application < Rails::Application
 config.encoding = "utf-8"

 # Configure sensitive parameters which will be filtered from the log file.
 config.filter_parameters += [:password]

 # Enable escaping HTML in JSON.
 config.active_support.escape_html_entities_in_json = true
      config.active_record.whitelist_attributes = true

 # Enable the asset pipeline
 config.assets.enabled = true

 # Version of your assets, change this if you want to expire all your assets
 config.assets.version = '1.0'

 config.action_mailer.delivery_method = :smtp
 config.action_mailer.smtp_settings = {
          :address => 'mail.example.net',
          :port    => 26,
          :authentication => 'plain',
          :user_name => 'xxxxxx',
          :password => 'xxxxxx',
 }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_charset = 'utf-8'

1 个答案:

答案 0 :(得分:1)

您应该从delayed_job中删除vendor/plugins,因为您已将Gemfile包含在vendor/plugins中。

通常,从Rails 2升级到3时,您应该尝试使用Gemfile中的宝石替换{{1}}中的Rails插件。