Hello, I am attempting to learn Ruby on Rails. I''m using Instant Rails 2.0 on a Windows computer. I really want the id number to autoincrement, but I am not sure how to do that. The script that''s generated after the scaffold is listed below. Any help is appreciated. class CreateMenuitems < ActiveRecord::Migration def self.up create_table :menuitems do |t| t.integer :id t.string :category t.text :categoryinfo t.string :name t.string :price t.text :iteminfo t.timestamps end end insert into menuitems values(NULL); def self.down drop_table :menuitems 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-/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 Jan 14, 2008 3:04 PM, Jeffery Wood <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am attempting to learn Ruby on Rails. I''m using Instant Rails > 2.0 on a Windows computer. I really want the id number to > autoincrement, but I am not sure how to do that. > > t.integer :idRemove this line. Rails will add the id field for you. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---