class UserController < ApplicationController def new @user = User.new p @user respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end ----------------------------------------------------------------------------------- -----------new.rhtml--------------- <h1>Fill the form to Register</h1> <%= @user %> <% form_for(@user) do |f| %> <%= f.error_messages %> <p> <%= f.label :login, Login %><br /> <%= f.text_field :login %> </p> <p> <%= f.label :password %><br /> <%= f.text_area :password %> </p> <p> <%= f.label :name %><br /> <%= f.text_area :name %> </p> <p> <%= f.label :email %><br /> <%= f.text_area :email %> </p> <p> <%= f.submit ''Create'' %> </p> <% end %> ---------------------------------------------------------------------------------------- --------in the browser i am getting error as follows--------------------- NoMethodError in User#new Showing app/views/user/new.html.erb where line #4 raised: undefined method `users_path'' for #<ActionView::Base:0x4fd6fe8> Extracted source (around line #4): 1: <h1>Fill the form to Register</h1> 2: <%= @user %> 3: 4: <% form_for(@user) do |f| %> 5: <%= f.error_messages %> 6: 7: <p> .... .... ------------------------------------- can any one tell how to solve this -- Posted via http://www.ruby-forum.com/.
On Mon, Jul 27, 2009 at 2:34 PM, Aashish Kiran<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > class UserController < ApplicationController > def new > @user = User.new > p @user > > respond_to do |format| > format.html # show.html.erb > format.xml { render :xml => @post } > > end > end > > ---------------------------------------------------------------------------------------- > --------in the browser i am getting error as > follows--------------------- > > NoMethodError in User#new > > Showing app/views/user/new.html.erb where line #4 raised: > > undefined method `users_path'' for #<ActionView::Base:0x4fd6fe8> > > Extracted source (around line #4): > > 1: <h1>Fill the form to Register</h1> > 2: <%= @user %> > 3: > 4: <% form_for(@user) do |f| %> > 5: <%= f.error_messages %> > 6: > 7: <p> > .... > ....Your routes.rb should contain a line called map.resources :users Let me know if that helps. Regards, Vagmi> ------------------------------------- > > can any one tell how to solve this > -- > Posted via http://www.ruby-forum.com/. > > > >-- Regards, Vagmi Mudumbai ---------------------------- CTO & Co Founder Artha42 Technology Solutions Pvt. Ltd., http://www.artha42.com