Hi, I am new to rails - just installed it couple of days ago (version 2.0.2). I was going through a tutorial on scaffold and it looked as if it is extremely simple to generate the working code for a simple table in no time. But I am facing some problem as I am unable to see the web form properly - it does not create the form according to the table definition in the database although it does create the action links. So, when I click on create - it creates an empty row in the table (the table only has id, name). The show page is empty but the click on update displays that update was successful. Here is how I created the application: 1. create table categories in mysql with id(int), name(string) 2. run rails rlapp 3. cd rlapp 4. ruby script\generate db:migrate categories 5. ruby script\generate scaffold category 5. ruby script\server 6. open the categories page in the browser I see that in edit.html.erb, there is a reference to form_for method. Is the form_for method not able to generate the proper form for the table? Any help is really appreciated. Below is the content of the edit file: <h1>Editing category</h1> <%= error_messages_for :category %> <% form_for(@category) do |f| %> <p> <%= f.submit "Update" %> </p> <% end %> <%= link_to ''Show'', @category %> | <%= link_to ''Back'', categories_path %> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
rk :> Here is how I created the application: > > 1. create table categories in mysql with id(int), name(string) > 2. run rails rlapp > 3. cd rlapp > 4. ruby script\generate db:migrate categories > 5. ruby script\generate scaffold categoryscript/generate scaffold category name:string> 5. ruby script\server > 6. open the categories page in the browser-- Jean-François. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks! That really works. Is this a new change to the scaffold script? Most of the tutorials that I have seen does not mention this part. This also means that for a decent sized table we have to name all the columns on the command line? On Dec 20, 10:24 am, "Jean-François Trân" <jft...-HujFcYLiWL6M4zKIHC2jIg@public.gmane.org> wrote:> rk : > > > Here is how I created the application: > > > 1. create table categories in mysql with id(int), name(string) > > 2. run rails rlapp > > 3. cd rlapp > > 4. ruby script\generate db:migrate categories > > 5. ruby script\generate scaffold category > > script/generate scaffold category name:string > > > 5. ruby script\server > > 6. open the categories page in the browser > > -- Jean-François.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---