I''m trying to write my first app in rails (no better way to learn than to do). I did my first migration to create the initial table, which worked fine. I generated the scaffold and added one new line item (a workout) to the database no problem. I then wanted to add some more fields to the database table, so I built another migration.. class AddFields < ActiveRecord::Migration def self.up add_column :workouts, :weight, :text add_column :workouts,:maxheart, :integer add_column :workouts,:minheart, :integer add_column :workouts,:avgheart, :integer add_column :workouts,:timehour, :integer add_column :workouts,:timemin, :integer add_column :workouts,:timesec, :integer end def self.down remove_column :workouts,:weight remove_column :workouts,:maxheart remove_column :workouts,:minheart remove_column :workouts,:avgheart remove_column :workouts,:timehour remove_column :workouts,:timemin remove_column :workouts,:timesec end end and ran rake, which worked fine. But when I go to the ''new'' action, those fields do NOT show up. They are in fact in the database, because I logged into mysql and looked, and they show up in the list view as empty fields. Am I missing a step to get them to show? -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On Dec 18, 2007, at 10:36 AM, Tom Dellaringa wrote:> > Am I missing a step to get them to show? >If you actually generated the scaffold with script/generate scaffold ... then you will have to edit the files to include the new fields. That''s actually the point of scaffolding...it''s just a place to get started. Have a look in views/<controller> to see which files you will need to modify. Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phillip Koebbe wrote:> On Dec 18, 2007, at 10:36 AM, Tom Dellaringa wrote: >> >> Am I missing a step to get them to show? >> > > If you actually generated the scaffold with > > script/generate scaffold ... > > then you will have to edit the files to include the new fields. > That''s actually the point of scaffolding...it''s just a place to get > started. Have a look in views/<controller> to see which files you > will need to modify. > > Peace, > PhillipAh! Duh...gotcha. So if I were using dynamic scaffolding it would have worked, but once I generated the actual files... makes sense. Thanks! -- 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-/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 -~----------~----~----~----~------~----~------~--~---