views:

8

answers:

1
sessions_controller.rb

  def create
    if user = User.authenticate(params[:login], params[:password])
      session[:user_id] = user.id
      redirect_to posts_path
    else
      render :action => 'new'
    end
  end


routes.rb

  get "sessions/create"
  get "sessions/destroy"
  get "sessions/new"

  resources :posts
  resource  :session
  resources :users

  match '/login',  :to => 'sessions#new',     :as => 'login'
  match '/logout', :to => 'sessions#destroy', :as => 'logout'

Is it possible to keep the /login url after the render :action => "new" ??? thanks.

A: 

The easy solution would be to simply change render :action => 'new' to redirect_to '/login'. I'm not amazingly fond of this, but it should solve the problem for you.

vonconrad