2011-12-22 1 views
1

в настоящее время используют рубин-1.8.7-P302 [i386]рельсы обновления с 1.8.7 до 1.9.2 вводит синтаксическую ошибку

переход к рубин рубин-1.9.2-p0 [i386]

бега рельсы 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 

это barfing на «helper_method: current_facebook_client,: only =>: after_sign_in_path_for», но для жизни меня не видно, что случилось с синтаксисом (тем более, что он работал в 1.8.7.

+0

Попробуйте обновить до версии 1.9.2 или 1.9.3 – rwilliams

+0

Зачем нужен helper_method «only» after_sign_in_path_for ... это метод. вы не должны иметь: only =>: after_sign_in_path_for – drhenner

ответ

1

Метод вызова helper_method неправильно, helper_method (* денатурат) принимает переменное количество символов, представляющих вспомогательные имена, это делает не взять КЛЮЧ хэш helper_method (* денатурат, выбирает = {})

# 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 
+0

Кстати, если вы все-таки обновляете ruby, я бы предложил использовать ruby ​​1.9.2-p290 вместо -p0, есть много исправлений. – sunkencity

+1

Если он обновляется, то он может также обновиться до 1.9.3-p0, который, как сообщается, имеет много ускорений, когда дело доходит до времени запуска Rails. Или возникают какие-либо новые проблемы с этой версией, и Rails возникла в среднем? –

+0

Я еще не пробовал 1.9.3, так что я не могу ручаться за него, но да, звучит разумно. – sunkencity

 Смежные вопросы

  • Нет связанных вопросов^_^