Rails 3.2带有ruby 1.8语法问题(意外的tASSOC,期待'}',意外':',期待kEND)

时间:2012-05-04 18:56:02

标签: ruby deployment syntax ruby-on-rails-3.2

我正在尝试部署rails 3.2应用程序,其中ruby版本为1.8。我可以解决一些哈希语法问题,但仍然有一个我无法克服:

注意我聘请了一个不会安装ruby 1.9的托管服务。

错误是

from {app_path}/config/environment.rb:5
[ pid=586526 thr=203092280 file=utils.rb:176 time=2012-05-04 15:32:29.667 ]: *** Exception SyntaxError in PhusionPassenger::Rack::ApplicationSpawner ({app_path}/config/initializers/wrap_parameters.rb:8: syntax error, unexpected tASSOC, expecting '}'
{app_path}/config/initializers/wrap_parameters.rb:8: warning: don't put space before argument parentheses
{app_path}/config/initializers/wrap_parameters.rb:8: warning: don't put space before argument parentheses
from {app_path}/config/environment.rb:5
[ pid=539635 thr=202883380 file=utils.rb:176 time=2012-05-04 14:30:21.570 ]: *** Exception SyntaxError in PhusionPassenger::Rack::ApplicationSpawner ({app_path}/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND
from {app_path}/config/environment.rb:5
[ pid=539635 thr=202883380 file=utils.rb:176 time=2012-05-04 14:29:31.744 ]: *** Exception SyntaxError in PhusionPassenger::Rack::ApplicationSpawner ({app_path}/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND

该文件是config / initializers / wrap_parameters.rb,内容如下:

ActiveSupport.on_load(:action_controller) do
  # it was originally 
  # wrap_parameters format: [:json] # ruby 1.9 syntax


  # the follow line is line 8
  wrap_parameters :format => [:json] # ruby 1.8 syntax

  # i already tried
  # wrap_parameters {:format => [:json]}
  # wrap_parameters({:format => [:json]})
  # wrap_parameters(:format => [:json])

end

# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
  self.include_root_in_json = false
end

这是config / enviroment.rb

#config/environment.rb 
# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
Flog::Application.initialize!

我试图摆脱这个问题几个小时。

谢谢你的推荐

0 个答案:

没有答案