So I have a snazzy custom route for login
# routes.rb
map.login '/login', :controller => 'sessions', :action => 'new'
Visit www.asite.com/login and you're there. As is custom with failed login, however, we'll do the following in our action. Note what happens on failed login.
# sessions_controller.rb
def create
self.current_user = User.authenticate(params[:email], params[:password])
if logged_in?
# some work and redirect the user
else
flash.now[:warning] = "The email and/or password you entered is invalid."
render :action => 'new'
end
end
This is very typical. Simply render the new action and prompt for login again. Unfortunately you also get with it an ugly URL: www.asite.com/session. Ick! Is it possible to get rendering to respect the original URL?