anij
2008-Jun-08 13:59 UTC
Newbie Problem : Scaffold does not generate html form input fields
Hi Friends, I am newbie to Ruby on Rails and trying to follow through my first tutorial on RoR. I am following the "Getting Started with Rails" manual on RoR. When I type "$ ruby script\generate scaffold Post blog" it gives me an error something to the effect that says invalid number of arguments. So I do the following. "$ ruby script\generate scaffold Post" That generates the scaffold code. This seems to work and generate all files. However, it does not generate any of the fields that are required for my model or views e.g. app\model\post.rb has the following code class Post < ActiveRecord::Base end app\views\posts\new.html.erb has the following code <h1>New post</h1> <% form_for(@post) do |f| %> <%= f.error_messages %> <p> <%= f.submit "Create" %> </p> <% end %> <%= link_to ''Back'', posts_path %> I am using ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] and Rails 2.1.0 Any hints? CAN SOMEONE GUIDE ME? Anij --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Breen
2008-Jun-08 14:15 UTC
Re: Newbie Problem : Scaffold does not generate html form input fields
To generate some fields you need to tell the scaffold what fields you want and what type they are. So, for example, if you wanted to create a Post with a title and body you would do: script/generate scaffold Post title:string body:text If you just type in ''script/generate scaffold'' you''ll get examples on how to use the scaffold generator. best. mike On Jun 8, 2008, at 9:59 AM, anij wrote:> > Hi Friends, > > I am newbie to Ruby on Rails and trying to follow through my first > tutorial on RoR. I am following the "Getting Started with Rails" > manual on RoR. > > When I type > "$ ruby script\generate scaffold Post blog" > > it gives me an error something to the effect that says invalid number > of arguments. > > So I do the following. > "$ ruby script\generate scaffold Post" > > That generates the scaffold code. This seems to work and generate all > files. However, it does not generate any of the fields that are > required for my model or views e.g. > > app\model\post.rb has the following code > class Post < ActiveRecord::Base > end > > app\views\posts\new.html.erb has the following code > <h1>New post</h1> > > <% form_for(@post) do |f| %> > <%= f.error_messages %> > > <p> > <%= f.submit "Create" %> > </p> > <% end %> > > <%= link_to ''Back'', posts_path %> > > I am using ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] and > Rails 2.1.0 > > Any hints? > > CAN SOMEONE GUIDE ME? > > Anij > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
anij
2008-Jun-08 17:43 UTC
Re: Newbie Problem : Scaffold does not generate html form input fields
Thank you Mike, It really helped!!! I guess the "getting started" that I am referring to is for the older version because now I am stuck at "start_form_tag" and can''t seem to find that in RDoc. I need to find the latest "getting started". If you happen to know the location do ping back. and thank you for your help once again. Regards, anij On Jun 8, 7:15 pm, Michael Breen <hard...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> To generate some fields you need to tell the scaffold what fields you > want and what type they are. So, for example, if you wanted to create > a Post with a title and body you would do: > > script/generate scaffold Post title:string body:text > > If you just type in ''script/generate scaffold'' you''ll get examples on > how to use the scaffold generator. > > best. > mike > > On Jun 8, 2008, at 9:59 AM, anij wrote: > > > > > Hi Friends, > > > I am newbie to Ruby on Rails and trying to follow through my first > > tutorial on RoR. I am following the "Getting Started with Rails" > > manual on RoR. > > > When I type > > "$ ruby script\generate scaffold Post blog" > > > it gives me an error something to the effect that says invalid number > > of arguments. > > > So I do the following. > > "$ ruby script\generate scaffold Post" > > > That generates the scaffold code. This seems to work and generate all > > files. However, it does not generate any of the fields that are > > required for my model or views e.g. > > > app\model\post.rb has the following code > > class Post < ActiveRecord::Base > > end > > > app\views\posts\new.html.erb has the following code > > <h1>New post</h1> > > > <% form_for(@post) do |f| %> > > <%= f.error_messages %> > > > <p> > > <%= f.submit "Create" %> > > </p> > > <% end %> > > > <%= link_to ''Back'', posts_path %> > > > I am using ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] and > > Rails 2.1.0 > > > Any hints? > > > CAN SOMEONE GUIDE ME? > > > Anij--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
anij
2008-Jun-08 18:45 UTC
Re: Newbie Problem : Scaffold does not generate html form input fields
Hi Friends, Just in case anyone is following this post... If you are newbie like me and trying to follow the "Getting Started" on http://www.railsdocumentation.org/book.html then Be careful!!! because it is not yet updated for Rails 2.x. There are significant changes in the way things are done in Rails 2.x. Start by reading this... (hard learned lesson after wasting a perfect rainy sunday) http://wiki.rubyonrails.org/rails/pages/GettingStartedWithRails http://www.jonathansng.com/ruby-on-rails/ruby-on-rails-tutorial-now-with-more-202/ Regards, anij On Jun 8, 10:43 pm, anij <j.aniru...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you Mike, > > It really helped!!! > > I guess the "getting started" that I am referring to is for the older > version because now I am stuck at "start_form_tag" and can''t seem to > find that in RDoc. > > I need to find the latest "getting started". If you happen to know the > location do ping back. > > and thank you for your help once again. > > Regards, > anij > > On Jun 8, 7:15 pm, Michael Breen <hard...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > To generate some fields you need to tell the scaffold what fields you > > want and what type they are. So, for example, if you wanted to create > > a Post with a title and body you would do: > > > script/generate scaffold Post title:string body:text > > > If you just type in ''script/generate scaffold'' you''ll get examples on > > how to use the scaffold generator. > > > best. > > mike > > > On Jun 8, 2008, at 9:59 AM, anij wrote: > > > > Hi Friends, > > > > I amnewbieto Ruby on Rails and trying to follow through my first > > > tutorial on RoR. I am following the "Getting Started with Rails" > > > manual on RoR. > > > > When I type > > > "$ ruby script\generate scaffold Post blog" > > > > it gives me an error something to the effect that says invalid number > > > of arguments. > > > > So I do the following. > > > "$ ruby script\generate scaffold Post" > > > > That generates the scaffold code. This seems to work and generate all > > > files. However, it does not generate any of the fields that are > > > required for my model or views e.g. > > > > app\model\post.rb has the following code > > > class Post < ActiveRecord::Base > > > end > > > > app\views\posts\new.html.erb has the following code > > > <h1>New post</h1> > > > > <% form_for(@post) do |f| %> > > > <%= f.error_messages %> > > > > <p> > > > <%= f.submit "Create" %> > > > </p> > > > <% end %> > > > > <%= link_to ''Back'', posts_path %> > > > > I am using ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] and > > > Rails 2.1.0 > > > > Any hints? > > > > CAN SOMEONE GUIDE ME? > > > > Anij--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Cloutier
2010-Aug-27 14:38 UTC
Re: Newbie Problem : Scaffold does not generate html form input fields
Michael Breen wrote:> To generate some fields you need to tell the scaffold what fields you > want and what type they are. So, for example, if you wanted to create > a Post with a title and body you would do: > > script/generate scaffold Post title:string body:text > > If you just type in ''script/generate scaffold'' you''ll get examples on > how to use the scaffold generator. > > best. > mikeThanks a lot, this really helped me, I couldn''t find why my "new" page was empty. -- 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.