我真的不认为存在语法问题,我认为这可能是版本问题,不过,你们觉得这是什么样的?请注意,这只发生在生产环境中。我正在使用乘客(因为它是 Rails 3,我不喜欢在生产中使用 beta gems):
Gem 版本:1.8.23 Rails 版本:3.2.11 Ruby 版本:1.9.3p374(我升级它认为它会有所帮助,我之前认为是 1.8.7)
# rails s -e production
=> Booting WEBrick
=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require': /usr/lib/ruby/gems/1.8/gems/spree_api-1.3.1/app/controllers/spree/api/product_properties_controller.rb:11: syntax error, unexpected '.' (SyntaxError)
.page(params[:page]).per(params[:per_page])
^
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:439:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:438:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:438:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:436:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:436:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/devise-2.2.3/lib/devise/controllers/url_helpers.rb:47:in `to_proc'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `all'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:434:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/finisher.rb:53
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/$user/rails_apps/store/config/environment.rb:5
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require'
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /home/$user/rails_apps/store/config.ru:3
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
from /home/$user/rails_apps/store/config.ru:0:in `new'
from /home/$user/rails_apps/store/config.ru:0
如果需要更多信息,请告诉我,我可以发送任何要求的信息(当然是在合理范围内)。
编辑补充:
我修正了任性的“。” 但现在看到这个:
# rails s -e production
=> Booting WEBrick
=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require': /usr/lib/ruby/gems/1.8/gems/spree_api-1.3.1/app/controllers/spree/api/v1/base_controller.rb:68: odd number list for Hash (SyntaxError)
render :text => { exception: exception.message }.to_json,
^
/usr/lib/ruby/gems/1.8/gems/spree_api-1.3.1/app/controllers/spree/api/v1/base_controller.rb:68: syntax error, unexpected ':', expecting '}'
render :text => { exception: exception.message }.to_json,
^
/usr/lib/ruby/gems/1.8/gems/spree_api-1.3.1/app/controllers/spree/api/v1/base_controller.rb:68: syntax error, unexpected '}', expecting kEND
render :text => { exception: exception.message }.to_json,
^
/usr/lib/ruby/gems/1.8/gems/spree_api-1.3.1/app/controllers/spree/api/v1/base_controller.rb:69: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:status => 422 and return
^
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:439:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:438:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:438:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:436:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:436:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/devise-2.2.3/lib/devise/controllers/url_helpers.rb:47:in `to_proc'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `all'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb:434:in `eager_load!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application/finisher.rb:53
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/jackal/rails_apps/store/config/environment.rb:5
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `polyglot_original_require'
from /usr/lib/ruby/gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /home/jackal/rails_apps/store/config.ru:3
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
from /home/jackal/rails_apps/store/config.ru:0:in `new'
from /home/jackal/rails_apps/store/config.ru:0