def create
chef = Chef.find_by(email: params[:email])
if chef && chef.authenticate(params[:password])
**session[:chef_id] = chef.id**
flash[:success] = "You logged In"
redirect_to recipes_path
else
flash.now[:danger] = "Check your email or password"
render 'new'
end
end
session[:chef_id] = chef.id
嗎?那session[:chef_id]
是一種變數還是什麼?廚師的ID是分配給哪個?我可以在那裏使用其他名字嗎?
謝謝!那解決了 – Vijay