
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 0.99 KB | hits: 24 | expires: Never
Rails 3 render partial from another controller (error: ActionView::MissingTemplate)
Missing partial /login with {:handlers=>[:rjs, :builder, :rhtml, :erb, :rxml], :locale=>[:en, :en], :formats=>[:html]} in view paths "/app/views"
<%= render '/login' %>
match '/login' => "sessions#new", :as => "login"
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 " # don't show pass + params[:password]
#render :action => "new"
redirect_to login_path, :notice => "wrong user pass"
end
end
def destroy
reset_session
redirect_to root_path, :notice => "successfully logged out"
end
end
form_for @user, :url => sessions_path do |f|
f.text_field :email