当用户尝试更新其个人资料时,我的应用程序似乎随机抛出“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 protected] /cdn-cgi/l/email-protection", "network_id"=>"",
"password_confirmation"=>"[FILTERED]", "mobile"=>"", "password"=>"[FILTERED]",
"email"=>"[email protected] /cdn-cgi/l/email-protection"}, "action"=>"update", "_method"=>"put", "id"=>"5089",
"controller"=>"users"}
老实说,不知道从哪里开始寻找。我有一位用户说他可以从 IE 更新相同的信息,但不能从 Firefox 更新。当我使用他们的相同信息时,我可以毫无问题地进行更新。所以,我很困惑。