简体   繁体   English

SessionsController#create中的NoMethodError

[英]NoMethodError in SessionsController#create

class SessionsController < ApplicationController
  def new
    @title = "Sign in"
  end

  def create
    user = User.authenticate(params[:session][:email],
                             params[:session][:password])
    if user.nil?
      flash[:error] = "Invalid email/password combination."
      @title = "Sign in"
      render 'new'
    else
      # Sign the user in and redirect to the user's show page.
    end
  end
  def destroy

  end
end

Currently working on a project and have got an a undefined NoMethodErorr. 当前正在从事一个项目,并且有一个未定义的NoMethodErorr。 Done thorough research and still unable to find anything. 经过彻底的研究,仍然找不到任何东西。 What I have done is that inside the create actions the params takes the paramaeters needed to authenticate. 我所做的是,在创建动作中,参数接受了进行身份验证所需的参数。 I created the following method User.authenticatte. 我创建了以下方法User.authenticatte。 However when I run this in my localhost I get the following error. 但是,当我在本地主机上运行此命令时,出现以下错误。 What could possibly be the problem? 可能是什么问题?

NoMethodError in SessionsController#create

undefined method `authenticate' for #<Class:0x4589eb0>

The controller is looking for an Authenticate method for the User model. 控制器正在寻找User模型的Authenticate方法。 This method is not present. 此方法不存在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SessionsController#create中的NoMethodError - NoMethodError in SessionsController#create Api :: SessionsController#create中的NoMethodError - NoMethodError in Api::SessionsController#create rails 4:Devise :: SessionsController#create中的NoMethodError - rails 4 : NoMethodError in Devise::SessionsController#create 设计中的 NoMethodError::SessionsController#create undefined method `current_sign_in_at&#39; - NoMethodError in Devise::SessionsController#create undefined method `current_sign_in_at' Rails Devise LDAP错误:Devise :: SessionsController#create中的NoMethodError - Rails Devise LDAP Error: NoMethodError in Devise::SessionsController#create SessionsController#NoilMethodError为nil:NilClass创建未定义的方法“ []” - NoMethodError in SessionsController#create undefined method `[]' for nil:NilClass SessionsController#中的Rails 4 NoMethodError为nil:NilClass创建未定义的方法&#39;slice&#39; - Rails 4 NoMethodError in SessionsController#create undefined method `slice' for nil:NilClass SessionsController#create中的NoMethodError-#的未定义方法&#39;[]&#39; <Oauth::Access_Token…> - NoMethodError in SessionsController#create - Undefined method '[]' for #<Oauth::Access_Token…> 在用户模型中调用方法时,SessionsController#create中的NoMethodError - NoMethodError in SessionsController#create when calling a method in user model 使用Omniauth Facebook身份验证Railscast 360在SessionsController#create中出现NoMethodError - NoMethodError in SessionsController#create using Omniauth Facebook authentication railscast 360
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM