当用户尝试更新他们的个人资料时,我的应用程序似乎随机抛出“nil:NilClass 的未定义方法 `map'”错误。
但奇怪的是它说错误发生在更新时,但错误行实际上是在视图中。
完整错误:
users#update (ActionView::TemplateError) "undefined method `map' for nil:NilClass"
On line #52 of app/views/users/edit.html.erb
Line 52: <%= options_from_collection_for_select(@networks_domestic, 'id', 'name', @user.network_id) %>
以下是最近一个错误的参数:
{"user"=>{"email_notify"=>"email@example.com", "network_id"=>"",
"password_confirmation"=>"[FILTERED]", "mobile"=>"", "password"=>"[FILTERED]",
"email"=>"email@example.com"}, "action"=>"update", "_method"=>"put", "id"=>"5089",
"controller"=>"users"}
老实说,甚至不知道从哪里开始寻找。我有一个用户说他可以从 IE 更新相同的信息,但不能从 Firefox 更新。当我使用他们相同的信息时,我可以毫无问题地更新。所以,我很难过。