{"id":559,"date":"2022-08-30T15:03:22","date_gmt":"2022-08-30T15:03:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/error-simple-login-undefined-method-key-for-nilnilclass-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:03:22","modified_gmt":"2022-08-30T15:03:22","slug":"error-simple-login-undefined-method-key-for-nilnilclass-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/error-simple-login-undefined-method-key-for-nilnilclass-collection-of-common-programming-errors\/","title":{"rendered":"Error Simple Login &ldquo;undefined method `key?&#39; for nil:NilClass&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>Please help-me i wen make a simple login and this error appear when i test this. Please how i solve this error?<\/p>\n<p>NoMethodError in UserController#login<\/p>\n<p>undefined method `key?&#8217; for nil:NilClass<\/p>\n<pre><code>  def login\n    if request.post?\n      if session[:user] = User.authenticate(params[:user][:login],params[:user][:password])\n        flash[:message] = 'Voce esta Logado !'\n        redirect_to_stored\n      else\n        flash[:warning] = 'Usuario e\/ou Senha incorreta !'\n      end\n    end\n  end\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 20:51:30. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Please help-me i wen make a simple login and this error appear when i test this. Please how i solve this error? NoMethodError in UserController#login undefined method `key?&#8217; for nil:NilClass def login if request.post? if session[:user] = User.authenticate(params[:user][:login],params[:user][:password]) flash[:message] = &#8216;Voce esta Logado !&#8217; redirect_to_stored else flash[:warning] = &#8216;Usuario e\/ou Senha incorreta !&#8217; end end [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-559","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=559"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/559\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}