开发者

NoMethodError in SessionsController#create

开发者 https://www.devze.com 2023-03-14 22:50 出处:网络
class SessionsController < ApplicationController def new @title = \"Sign in\" end def create user = User.authenticate(params[:session][:email],
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. 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 t开发者_如何学Che following method 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. This method is not present.

0

精彩评论

暂无评论...
验证码 换一张
取 消