我正在练习 Rails,我在“会话”主题中,我收到消息“ApplicationController:Class 的未定义方法‘会话’”
请帮我
这是代码 *(控制器应用程序)
class ApplicationController < ActionController::Base
session :session_key => 'ruby_cookies'
end
*(当我想创建 cookie 时的控制器)
class RegistroController < ApplicationController
def index
end
def login
if request.post?
p_user = User.new(params[:user])
user = User.find_by_nombre_and_password(p_user.nombre, p_user.password)
if user
session[:user_id] = user.id
flash[:notice] = "se ha identificado correctamente"
redirect_to home_url
else
flash[:notice] = "se incorrecto psps"
redirect_to login_url
end
end
end
def logout
session[:user_id] = nil
flash[:notice] = "adios sayonara"
redirect_to home_url
end
end