开发者

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. 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜