Ruby on rails 设计rails 3和会话
我正试图从我的初学者风格的用户认证转变为设计。我已经安装了Desive gem,运行了安装,并将Desive列添加到了我的用户模型中。现在,我正在努力让其他一切正常工作,我遇到的第一个问题是我的会话控制器。以下是我的旧控制器的外观:Ruby on rails 设计rails 3和会话,ruby-on-rails,ruby-on-rails-3,devise,Ruby On Rails,Ruby On Rails 3,Devise,我正试图从我的初学者风格的用户认证转变为设计。我已经安装了Desive gem,运行了安装,并将Desive列添加到了我的用户模型中。现在,我正在努力让其他一切正常工作,我遇到的第一个问题是我的会话控制器。以下是我的旧控制器的外观: class SessionsController < ApplicationController skip_before_filter :authorize def new end def create user = User
class SessionsController < ApplicationController
skip_before_filter :authorize
def new
end
def create
user = User.find_by_name(params[:name])
if user and user.authenticate(params[:password])
session[:user_id] = user.id
redirect_to home_url action: 'index'
else
redirect_to login_url, action: 'new', alert: "Invalid user/password combination"
end
end
def destroy
session[:user_id] = nil
redirect_to login_url, notice: "Logged out"
end
end
这是一个独立的控制器。当我尝试登录时,if行导致参数错误。我是否还需要这个会话控制器,或者Desive现在是否为我解决了所有这些问题 Deviate负责所有与授权会话、注册、密码相关的控制器。您可以通过@D.K查看这些内容,Deviate将负责所有这些内容。请检查此url