를 제출하고 내가 바보 같은 질문이 리디렉션 : 내 session_controller에서 을 내가가, 일치 '/ 로그인 절차'를이 노선에simple_form_for에 내가 루비 온 레일즈 멍청한 놈이야
def create
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
session[:user_id] = user.id
redirect_to root_path, :notice => "Logged in!"
else
flash.now.alert = "Invalid email or password"
render "new"
end
end
이 '세션 #new 'new.html.haml에서
나는 "로그인"버튼을, 나는 그것이 어떻게 작동하는지 그 방법은 (호출됩니다 "생성"기대 누를 때 나는
= simple_form_for :session do |f|
= f.input :email
= f.input :password
= f.button :submit, 'Sign in!'
이 내 사용자 모델),하지만 디버그 날 "새로운"방법과 나는 "authenticity_token"withot 채우기 이메일과 비밀 번호를 보여줍니다. 누군가가 나에게 무슨 소리를 들려 줄 수 있니? "new"메서드가 호출 된 다음 다른 메서드가 호출되는 것을 이해하지 못합니다.