我已经试过以下ROR代码:试图获得认证的红宝石在工作轨道
class SessionsController < ApplicationController
def new
end
def create
user = User.authenticated(params[:email], params[:password)
if user
session[:user_id] = user_id
flash[:notice] = "Log In Complete"
redirect_to root_url
else
flash.now.alert = "Invalid Email or Password"
render 'create'
end
end
def destroy
session[:user_id] = nil
redirect-to root_url, :notice =>"Logged Out"
end
end
但我得到这个错误:
I:/dev/abierto/app/controllers/sessions_controller.rb:5: syntax error, unexpected ')', expecting ']'
I:/dev/abierto/app/controllers/sessions_controller.rb:19: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '(' redirect-to root_url, :notice =>"Logged Out"
I:/dev/abierto/app/controllers/sessions_controller.rb:19: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.' redirect-to root_url, :notice =>"Logged Out"
I:/dev/abierto/app/controllers/sessions_controller.rb:22: syntax error, unexpected keyword_end, expecting $end
任何人可以帮助我,告诉我什么,我我做错了吗?
你读过错误日志吗?你是否试图理解它并改变它告诉你的错误? >>你的用户'params'缺少声明的结尾......只是**阅读错误信息** – JMax
看看'params [:password]' – Nick