【问题标题】:Passenger Errors in Ruby 1.9.3 HashesRuby 1.9.3 哈希中的乘客错误
【发布时间】:2012-10-28 07:27:32
【问题描述】:

我正在尝试在 Apache 上设置我的 Rails 应用程序。 我正在使用Passenger 加载我的Rails 应用Passenger 似乎不支持新的 Ruby 哈希格式 x: y,但支持旧的 :x => y。我使用的 Ruby 版本是1.9.3

这是我收到的错误消息:

categories_controller.rb:12: syntax error, unexpected ':', expecting '}' format.json { render json: @categories }
categories_controller.rb:23: syntax error, unexpected ':', expecting '}' format.json { render json: @category }
categories_controller.rb:34: syntax error, unexpected ':', expecting '}' format.json { render json: @category }
categories_controller.rb:50: syntax error, unexpected ':', expecting '}' ...redirect_to @category, notice: 'Category was successfully cr...
categories_controller.rb:51: syntax error, unexpected ':', expecting '}' ... format.json { render json: @category, status: :created, ...
categories_controller.rb:51: syntax error, unexpected ':', expecting '=' ...ender json: @category, status: :created, location: @category... 
categories_controller.rb:53: syntax error, unexpected ':', expecting '}' format.html { render action: "new" }
categories_controller.rb:54: syntax error, unexpected ':', expecting '}' ... format.json { render json: @category.errors, status: :un...
categories_controller.rb:54: syntax error, unexpected ':', expecting '=' ...son: @category.errors, status: :unprocessable_entity }
categories_controller.rb:66: syntax error, unexpected ':', expecting '}' ...redirect_to @category, notice: 'Category was successfully up...
categories_controller.rb:69: syntax error, unexpected ':', expecting '}' format.html { render action: "edit" }
categories_controller.rb:70: syntax error, unexpected ':', expecting '}' ... format.json { render json: @category.errors, status: :un...
categories_controller.rb:70: syntax error, unexpected ':', expecting '=' ...son: @category.errors, status: :unprocessable_entity }

是否有任何解决方法。我不想将所有哈希转换为 :x => y 格式。

【问题讨论】:

  • 是什么让您认为Passenger 使用的是Ruby 1.9.3?
  • 因为当我将哈希格式更改为 :x => y 时,它可以工作。当我使用 ruby​​ 1.8.7 时会发生这种情况。但是使用 1.9.3 时,哈希格式的格式为 :x y。所以我唯一的猜测是因为 ruby​​ 版本。
  • 显然,Passenger 使用的是 1.8,但您需要它才能使用 1.9.3。同样,您为什么认为Passenger 显然不使用1.9 时会使用1.9。
  • 我猜是因为我的 PassengerRoot 指向 user/lib/ruby1.8 。所以它不承认 ruby​​ 1.9 syantax 。我会尝试下载 ruby​​1.9 gems ..

标签: ruby-on-rails apache passenger compatibility ruby-1.9.3


【解决方案1】:

我认为您的乘客使用的是 Ruby 1.8.x。

将您的乘客切换到 3.2 版本,以确保您为此 rails 应用程序使用的是 1.9.3。

参考:https://serverfault.com/a/388821

【讨论】:

  • 哪里有passenger 3.2的安装说明?
猜你喜欢
  • 2011-04-17
  • 1970-01-01
  • 1970-01-01
  • 2013-01-30
  • 1970-01-01
  • 1970-01-01
  • 2013-05-06
  • 2012-05-10
  • 2014-03-03
相关资源
最近更新 更多