0

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

注意我雇佣了一个不会安装 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

这是配置/环境.rb

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

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

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

提前谢谢你

4

0 回答 0