broken route path?

I've added the following to routes.rb

map.resource :login

if I do a rake routes I see

yadav@Energy64X2 $ rake routes (in /home/yadav/dev/rails/upload)     new_login GET /login/new(.:format) {:controller=>"logins", :action=>"new"}    edit_login GET /login/edit(.:format) {:controller=>"logins", :action=>"edit"}         login GET /login(.:format) {:controller=>"logins", :action=>"show"}               PUT /login(.:format) {:controller=>"logins", :action=>"update"}               DELETE /login(.:format) {:controller=>"logins", :action=>"destroy"}               POST /login(.:format) {:controller=>"logins", :action=>"create"}

However my login form break when I use

<% form_tag login_path do %>

I am forced to use

<% form_tag '/login/create' do %>

otherwise I get the following error

NameError in LoginsController#create uninitialized constant LoginsController RAILS_ROOT: /home/yadav/dev/rails/upload Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:443:in `recognize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:436:in `call'

Rajinder Yadav wrote:

I've added the following to routes.rb

map.resource :login

if I do a rake routes I see

yadav@Energy64X2 $ rake routes (in /home/yadav/dev/rails/upload)    new_login GET /login/new(.:format) {:controller=>"logins", :action=>"new"}   edit_login GET /login/edit(.:format) {:controller=>"logins", :action=>"edit"}        login GET /login(.:format) {:controller=>"logins", :action=>"show"}              PUT /login(.:format) {:controller=>"logins", :action=>"update"}              DELETE /login(.:format) {:controller=>"logins", :action=>"destroy"}              POST /login(.:format) {:controller=>"logins", :action=>"create"}

However my login form break when I use

<% form_tag login_path do %>

I am forced to use

<% form_tag '/login/create' do %>

otherwise I get the following error

NameError in LoginsController#create uninitialized constant LoginsController

I realized my error, I created the login controller as a singular, so rails got tripped up. It's working now.

Kind Regards, Rajinder Yadav