我的rails应用程序出现此错误:
$user->country->name;
我的模特中抱怨的是:
syntax error, unexpected ',', expecting =>
似乎是validates :body, presence: true,
length: {minimum: 2, maximum: 1000},
:chat_room_id, :user_id
和:chat_room_id
有什么想法吗?谢谢!
答案 0 :(得分: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}
答案 1 :(得分:0)
我的参数列表: {:utf8,:authenticity_token,:worklog => {:typee,:do,:todo,:feel,:plan_done,:plan,:week_feel,:score,:good,:nogood},:commit}
添加thoes参数后,在数据库中获取空值