Rails 3, using mongoid but syntax error gets produced
In my development environment, which is windows 7, Ruby1.9.2p180, everything works fine.
However, in production environment, which is Ubuntu 10.04, Ree 1.8.7 using rvm, following error gets produced. (I am using passenger-apache-module to run the application.)
/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 ^
Where those lines have below codes
field :user_id, type: Hash
field :username, type: String
field :title, type: String
field :content, type: String
field :disp开发者_开发百科lay_content, type: String
Assuming above lines work fine in development, do you think it may be a problem with syntax parser??? How can I resolve this problem?
You are using the 1.9.2 hash syntax. If you want to run on both 1.9.2 and 1.8.7 then try this:
field :user_id, :type => Hash
field :username, :type => String
field :title, :type => String
field :content, :type => String
field :display_content, :type => String
精彩评论