routes issues with rails3

Here i am using rails3, here the view.html.erb form have one login button, so when i click on that button, gives no routes matches :controller => ‘home’, :action => ‘login’. But i have put that in routes.rb. Why this happening? view.html.erb

<%= form_tag( { :controller => 'home', :action => 'login' }, { :method => 'post'}) do %>
<%= text_field(:name, :name, :class => "span2",:placeholder => "Username") %>
<%= password_field_tag(:password, :password,  :class =>"span2") %>
<%= submit_tag "Login", :class => "btn btn-primary" %>
<% end %>
routes.rb

 resources :home do
   post :login, :on => :member  
end

homecontroller.rb

class HomeController < ApplicationController
def login

 end
end

You should define it as

:on => :collection

Problem is you defined it as :member, so it expects an id to be passed, so the expected url would look like /home/:id/login

Hope this helps!