1

我正在尝试在Apache上设置我的Rails应用程序。我正在使用 Passenger 加载我的Rails App。似乎Passenger不支持新的Ruby 哈希格式,但支持旧的。我使用的 Ruby 版本是x: y:x => y1.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 格式。

4

1 回答 1

1

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

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

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

于 2012-10-28T10:40:08.550 回答