So I just started with rails a few days ago and I am wondering why this does not work. I get an ArgumentError in User#create Extracted source (around line #2): 1: 2: <% form.for :user, @user, :url => {:action => "create"}, :html => {:class => "create_form"} do |f| %> 3: 4: <p> 5: <%= f.label :username %><br /> I believe this is what is relevant to what is causing the error views/user/create.html.erb <% form.for :user, @user, :url => {:action => "create"}, :html => {:class => "create_form"} do |f| %> <p> <%= f.label :username %><br /> <%= f.text_field :username %> </p> <p> <%= f.label :password %><br /> <%= f.text_field :password %> </p> <p> <%= f.label :first %><br /> <%= f.text_field :first %> </p> <p> <%= f.label :last %><br /> <%= f.text_field :last %> </p> <p> <%= f.label :email %><br /> <%= f.text_field :email %> </p> <p> <%= f.submit_tag ''Sign Up'' %> </p> <% end %> controllers/user_controller.rb class UserController < ActionController::Base def index @users = User.all end def create p params @user = User.new #@user.first = params[:user][:first] #@user.last = params[:user][:last] #@user.username = params[:user][:username] #@user.password = params[:user][:password] end end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jul 10, 8:37 am, Dd Ss <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> So I just started with rails a few days ago and I am wondering why this > does not work. I get an ArgumentError in User#create > > Extracted source (around line #2): > > 1: > 2: <% form.for :user, @user, :url => {:action => "create"}, :html =>That looks like a typo - it''s form_for, not form.for Fred> {:class => "create_form"} do |f| %> > 3: > 4: <p> > 5: <%= f.label :username %><br /> > > I believe this is what is relevant to what is causing the error > > views/user/create.html.erb > > <% form.for :user, @user, :url => {:action => "create"}, :html => > {:class => "create_form"} do |f| %> > <p> > <%= f.label :username %><br /> > <%= f.text_field :username %> > </p> > <p> > <%= f.label :password %><br /> > <%= f.text_field :password %> > </p> > <p> > <%= f.label :first %><br /> > <%= f.text_field :first %> > </p> > <p> > <%= f.label :last %><br /> > <%= f.text_field :last %> > </p> > <p> > <%= f.label :email %><br /> > <%= f.text_field :email %> > </p> > > <p> > <%= f.submit_tag ''Sign Up'' %> > </p> > <% end %> > > controllers/user_controller.rb > > class UserController < ActionController::Base > def index > @users = User.all > end > def create > p params > @user = User.new > #...@user.first = params[:user][:first] > #...@user.last = params[:user][:last] > #...@user.username = params[:user][:username] > #...@user.password = params[:user][:password] > end > end > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Dd Ss wrote:> So I just started with rails a few days ago and I am wondering why this > does not work. I get an ArgumentError in User#create >Yes? And what''s the rest of the error message? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try to understand the standard 7 object method called restfull API and it will make your life easier in rails. Application. Try checking http://railscas.com for a start. Cheers, Andre Sent from my iPhone On Jul 10, 2010, at 7:09 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Dd Ss wrote: >> So I just started with rails a few days ago and I am wondering why this >> does not work. I get an ArgumentError in User#create >> > > Yes? And what''s the rest of the error message? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> Try to understand the standard 7 object method called restfull API and it will make your life easier in rails. Application. Try checkinghttp://railscas.comfor a start. >Its actually http://www.railscasts.com ryan bate''s video screencasts, they really realy help -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m not sure if this is the reason or not, but "form.for" should be "form_for" in views/user/create.html.erb. Hope this helps. I''m not sure if this is the reason, but "form.for " should be "form_for" On Jul 10, 12:37 am, Dd Ss <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> So I just started with rails a few days ago and I am wondering why this > does not work. I get an ArgumentError in User#create > > Extracted source (around line #2): > > 1: > 2: <% form.for :user, @user, :url => {:action => "create"}, :html => > {:class => "create_form"} do |f| %> > 3: > 4: <p> > 5: <%= f.label :username %><br /> > > I believe this is what is relevant to what is causing the error > > views/user/create.html.erb > > <% form.for :user, @user, :url => {:action => "create"}, :html => > {:class => "create_form"} do |f| %> > <p> > <%= f.label :username %><br /> > <%= f.text_field :username %> > </p> > <p> > <%= f.label :password %><br /> > <%= f.text_field :password %> > </p> > <p> > <%= f.label :first %><br /> > <%= f.text_field :first %> > </p> > <p> > <%= f.label :last %><br /> > <%= f.text_field :last %> > </p> > <p> > <%= f.label :email %><br /> > <%= f.text_field :email %> > </p> > > <p> > <%= f.submit_tag ''Sign Up'' %> > </p> > <% end %> > > controllers/user_controller.rb > > class UserController < ActionController::Base > def index > @users = User.all > end > def create > p params > @user = User.new > #...@user.first = params[:user][:first] > #...@user.last = params[:user][:last] > #...@user.username = params[:user][:username] > #...@user.password = params[:user][:password] > end > end > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.