Skip to content


Subversion checkout URL

You can clone with
Download ZIP


1.0.2 routing problem #21

net1957 opened this Issue · 2 comments

2 participants


a running rails3.2.1 application fail when updating journey from 1.01 to 1.0.2


  resources :sessions, :only => [:new, :create, :destroy], :path => 'login', :as =>"login"
  match "/logout" => "sessions#destroy", :as => "logout"
  root :to => 'sessions#new'

on first attempt to go to root : ex: loalhost:3000
I got this error:

Started GET "/" for at Mon Feb 20 22:58:17 +0100 2012
Processing by SessionsController#new as HTML
  Rendered sessions/new.html.erb within layouts/application (78.1ms)
Completed 500 Internal Server Error in 422ms

ActionController::RoutingError (No route matches {:action=>"destroy", :controller=>"sessions"}):
  app/views/sessions/new.html.erb:5:in `_app_views_sessions_new_html_erb___532917218_68363088'

  Rendered C:/Soft/Dvlt/ruby/ruby187/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.0ms)

rake routes give:

     login_index POST   /login(.:format)                  sessions#create
       new_login GET    /login/new(.:format)              sessions#new
           login DELETE /login/:id(.:format)              sessions#destroy
          logout        /logout(.:format)                 sessions#destroy
info_pwd_mailbox GET    /mailboxes/:id/info_pwd(.:format) mailboxes#info_pwd
 to_list_mailbox GET    /mailboxes/:id/to_list(.:format)  mailboxes#to_list
loaddb_mailboxes POST   /mailboxes/loaddb(.:format)       mailboxes#loaddb
       mailboxes GET    /mailboxes(.:format)              mailboxes#index
                 POST   /mailboxes(.:format)              mailboxes#create
    edit_mailbox GET    /mailboxes/:id/edit(.:format)     mailboxes#edit
         mailbox GET    /mailboxes/:id(.:format)          mailboxes#show
                 PUT    /mailboxes/:id(.:format)          mailboxes#update
     historiques GET    /historiques(.:format)            historiques#index
            root        /                                 sessions#new

the view is a classic login view with in line 5:

    <%= form_tag(login_path) do %>

the new method on the controller is:

  def new

going back to 1.0.1 resolve the problem
any advice ?


The login_path helper is pointing to the destroy action - the actual helper for the create action is login_index_path.


yes, you are right ! but strange for me.
so i modified my routes:

match "/login" => "sessions#create", :as => :login, :via => :post
match "/login" => "sessions#new", :as => :login
match "/logout" => "sessions#destroy", :as => :logout, :via => [:get, :delete]
root :to => 'sessions#new'

that give:
login POST /login(.:format) sessions#create
login /login(.:format) sessions#new
logout GET|DELETE /logout(.:format) sessions#destroy
root / sessions#new

and it work with 1.0.2.

Thanks for your help !

@net1957 net1957 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.