I was able to create a table but i don''t know the syntax for adding/ removing fields. I tried this but it didn''t work: def self.up string :users, :name, :password end --~--~---------~--~----~------------~-------~--~----~ 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 Jul 29, 11:02 pm, oren <orengo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I was able to create a table but i don''t know the syntax for adding/ > removing fields. > > I tried this but it didn''t work: > > def self.up > string :users, :name, :password > endtry this def self.up add_column :modelname, :fieldname, :datatype end def self.down add_remove_ :modelname, :fieldname end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
this one worked: add_column :customers, :firstname, :string but not this one (multiple fields in one line) add_column :customers, :lastname, :password, :string also add_remove was not working too. any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oren wrote:> this one worked: > add_column :customers, :firstname, :string > > but not this one (multiple fields in one line) > add_column :customers, :lastname, :password, :string > > also add_remove was not working too. > > any ideas?Have you read /Agile Web Development with Rails/, by the Daves? There''s really no point in doing anything else first. If you simply cannot read it, can you Google for add_column? There must be thousands of examples out there, and all about Rails, because nobody else migrates. -- Phlip http://assertxpath.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
i have the book, but havn''t read all of it. i thought that it donesn''t have info about sexy migrations. i guess i was wrong. thanks! On Jul 29, 6:16 pm, "Phlip" <phlip2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> oren wrote: > > this one worked: > > add_column :customers, :firstname, :string > > > but not this one (multiple fields in one line) > > add_column :customers, :lastname, :password, :string > > > also add_remove was not working too. > > > any ideas? > > Have you read /Agile Web Development with Rails/, by the Daves? > > There''s really no point in doing anything else first. > > If you simply cannot read it, can you Google for add_column? There must be > thousands of examples out there, and all about Rails, because nobody else > migrates. > > -- > Phlip > http://assertxpath.rubyforge.org/--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> also add_remove was not working too.Sorry a typo ... remove_column :modelname, :fieldname --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sexy migrations only enhances creating tables. once the table is created, and you are adding, removing, anf changing columns, you need to use regular migrations, which is extremely well documented in the active record migrations rdoc. -Andrew On 7/30/07, Elchtest <peter.dickten-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > also add_remove was not working too. > > Sorry a typo ... > > remove_column :modelname, :fieldname > > > > > >-- Andrew Kuklewicz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---