I am trying to include a login (username / password) in the header of my application .html.erb. I get this error:
Missing partial /login with {:handlers=>[:rjs, :builder, :rhtml, :erb, :rxml], :locale=>[:en, :en], :formats=>[:html]} in view paths "/app/views"
This happens when I make this call in my application.html.erb application:
<%= render '/login' %>
'/ login' is defined on my .rb routes as:
match '/login' => "sessions#new", :as => "login"
UPDATE: here is my session controller:
class SessionsController < ApplicationController
def create
if user = User.authenticate(params[:email], params[:password])
session[:user_id] = user.id
user.last_login = Time.now
user.save
redirect_to root_path, :notice => "login successful"
else
flash.now[:alert] = "invalid login / password combination "
redirect_to login_path, :notice => "wrong user pass"
end
end
def destroy
reset_session
redirect_to root_path, :notice => "successfully logged out"
end
end
I saw in other posts that this may be due to the fact that it does not define the variable in the controller action, but since it is a session and it is in application.html.erb (application_controller.rb), I am not sure how to do this . Does anyone know how to do this? Thank!
source
share