我已經試過以下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