2016-12-17 49 views
0

我的Rails应用程序时收到此错误:Rails的错误:语法错误,意外 '',期待=>

syntax error, unexpected ',', expecting => 

在我的模型,它是在抱怨该生产线是这样的:

validates :body, presence: true, 
      length: {minimum: 2, maximum: 1000}, 
      :chat_room_id, :user_id 

似乎是:chat_room_id:user_id之间的逗号

任何想法?谢谢!

回答

3

你不能写验证状态,之后,什么验证:

如果想你想是这样的:

validates :body, presence: true, length: {minimum: 2, maximum: 1000} 
validates :chat_room_id, :user_id, presence: true 

或者另一种选择:

validates :body, :chat_room_id, :user_id, presence: true 
validates :body, length: {minimum: 2, maximum: 1000} 
0

我的参数列表: {:utf8::authenticity_token,:worklog => {:typee::do,:todo,:feel,:plan_done,:plan,:week_feel,:score,:good,:nogood},:commit}

添加thoes参数后在数据库中获取空值

相关问题