当前使用ruby-1.8.7-p302 [i386]
[i386]running rails 3.0.0
升级后出现以下错误:
# RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.0.0 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:53:in `class_eval': /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:54: syntax error, unexpected tLBRACE (SyntaxError)
def {:only=>:after_sign_in_path_for}(*args, &blk)
^
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:54: syntax error, unexpected '(', expecting $end
def {:only=>:after_sign_in_path_for}(*args, &blk)
^
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:53:in `block in helper_method'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:52:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:52:in `helper_method'
from /var/www/html/matcha/app/controllers/application_controller.rb:8:in `<class:ApplicationController>'
from /var/www/html/matcha/app/controllers/application_controller.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:346:in `require_or_load'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:491:in `load_missing_constant'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:183:in `block in const_missing'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `const_missing'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/devise-1.5.3/app/controllers/devise/confirmations_controller.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:346:in `require_or_load'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:300:in `depend_on'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in `require_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/engine.rb:137:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/engine.rb:137:in `block in eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/engine.rb:135:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/engine.rb:135:in `eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application/railties.rb:11:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application/railties.rb:11:in `all'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application.rb:107:in `eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /var/www/html/matcha/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /var/www/html/matcha/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/builder.rb:46:in `initialize'
from /var/www/html/matcha/config.ru:1:in `new'
from /var/www/html/matcha/config.ru:1:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/builder.rb:35:in `eval'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/builder.rb:35:in `parse_file'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/server.rb:162:in `app'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/server.rb:253:in `wrapped_app'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.4/lib/rack/server.rb:204:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands/server.rb:65:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
相关application_controller代码:
class ApplicationController < ActionController::Base
include Facebooker2::Rails::Controller
helper :all # include all helpers, all the time
protect_from_forgery
layout :layout_by_resource
before_filter :set_cache_buster
before_filter :current_facebook_user, :only => :after_sign_in_path_for
helper_method :current_facebook_client, :only => :after_sign_in_path_for
...
end
它是在"helper_method:current_facebook_client,:only =>:after_sign_in_path_for",但对于我的生活,我看不出语法有什么问题(特别是因为它在1.8.7中工作。
对helper_method的方法调用是错误的,helper_method(*meths)接受一个可变数量的代表助手名称的符号,它不接受一个opts散列helper_method(*meths, opts = {})
# from http://api.rubyonrails.org/
helper_method(*meths)
# Declare a controller method as a helper. For example, the
# following makes the current_user controller method available to the view:
class ApplicationController < ActionController::Base
helper_method :current_user, :logged_in?
def current_user
@current_user ||= User.find_by_id(session[:user])
end
def logged_in?
current_user != nil
end
end