Routing Error

my register.html.erb file is :

<% form_for :user do |form| %> <p><br />   <fieldset>     <legend>Enter Your Detail</legend>   Screen Name   <input type="text" name="screen_name" id="screen_name" size="20" maxlength="40"/>

</p>   <p>   Email   <input type="text" name="email" id="email" size="30"   maxlength="50"/>

</p> <p>Password   <input type="password" name="password" id="password" size="10"   maxlength="40"/>

</p> </fieldset> <p>   <input type="submit" name="register" id="register" value="Register!" /> </p>

<%end%>

and my user controller is

class UserController < ApplicationController

  def index   end

  def register     @title="Register"     if request.post? and params[:user]       @user = User.new(params[:user])       if @user.save         render :text =>"user created!"         end         end

  end

end

my application.html.erb is <!DOCTYPE html> <html> <head>   <title>My web Site</title>   <%= stylesheet_link_tag "site" %>   <%= javascript_include_tag :defaults %>   <%= csrf_meta_tag %>

</head> <body>   <h1>My Website</h1>   <p>     <%=link_to "Register",:action =>"register", :controller=>"user"%>|     <%=link_to "Index",:action=>"index",:controller=>"site"%>|     <%=link_to "About Us",:action=>"about",:controller=>"site"%>|     <%=link_to "Help",:action=>"help",:controller=>"site"%>   </p>

  <div id="content">   <%= @contenet_for_layout%>   </div> <p>   <% if ENV["RAILS_ENV"] == "development" %>   <%= debug(params)%>   <% end %>

</p>

<%= yield %>

</body> </html>

i dont no why i am getting routing error when i am click register button

First of all , why arent you been restful?? your register action is the same as a new action, rails creates the right routes for it with resource :user if you name that action new instead of register, you can use the :as method to make it say what you want in the url string. second why are you testing the http method? that is a requirement the router handles. and last , what is this for : @title=“Register” ?

First of all , why arent you been restful?? your register action is the same as a new action, rails creates the right routes for it with

resource :user if you name that action new instead of register, you can use the :as method to make it say what you want in the url string. second why are you testing the http method? that is a requirement the router handles. and last , what is this for : @title=“Register” ?

sorry i said you should name the action new but you should name it create