use*_*594 2 ruby-on-rails apache2 passenger mongoid
在我的开发环境中,即Windows 7,Ruby1.9.2p180,一切正常.
但是,在生产环境中,即使用rvm的Ubuntu 10.04,Ree 1.8.7,会产生以下错误.(我正在使用passenger-apache-module来运行应用程序.)
/home/randomapp/public_html/app/models/article.rb:14: syntax error, unexpected ':', expecting kEND field :user_id, type: Hash ^
/home/randomapp/public_html/app/models/article.rb:15: syntax error, unexpected ':', expecting kEND field :username, type: String ^
/home/randomapp/public_html/app/models/article.rb:16: syntax error, unexpected ':', expecting kEND field :title, type: String ^
/home/randomapp/public_html/app/models/article.rb:17: syntax error, unexpected ':', expecting kEND field :content, type: String ^
/home/randomapp/public_html/app/models/article.rb:18: syntax error, unexpected ':', expecting kEND field :display_content, type: String ^
Run Code Online (Sandbox Code Playgroud)
这些行的代码如下
field :user_id, type: Hash
field :username, type: String
field :title, type: String
field :content, type: String
field :display_content, type: String
Run Code Online (Sandbox Code Playgroud)
假设上面的行在开发中工作正常,你认为它可能是语法解析器的问题吗?我该如何解决这个问题?
您正在使用1.9.2哈希语法.如果你想在1.9.2和1.8.7上运行,那么试试这个:
field :user_id, :type => Hash
field :username, :type => String
field :title, :type => String
field :content, :type => String
field :display_content, :type => String
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
537 次 |
| 最近记录: |