le colibri
2007-Dec-30 14:51 UTC
very strange behavior of script/generate ModelName field:type
After the typing the following in my terminal: =================================./script/generate model Paper user_id:integer title:string body:text excerpt:text created_at:datetime updated_at:datetime ================================= the following migration is created... =================================class CreatePapers < ActiveRecord::Migration def self.up create_table :papers do |t| t.integer :user_id t.string :title t.text :body t.text :excerpt t.datetime :created_at t.datetime :updated_at t.timestamps end end def self.down drop_table :papers end end ================================= What happening here...? Regards, le colibri --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
le colibri
2007-Dec-30 14:55 UTC
Re: very strange behavior of script/generate ModelName field:type
Forgot to tell you that I''m on Rails 2.0.2 On Dec 30, 3:51 pm, le colibri <rvoogdge...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> After the typing the following in my terminal: ...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Martin Svalin
2007-Dec-30 18:13 UTC
Re: very strange behavior of script/generate ModelName field:type
On Dec 30, 2007 3:51 PM, le colibri <rvoogdgeert-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> =================================> class CreatePapers < ActiveRecord::Migration > def self.up > create_table :papers do |t| > t.integer :user_id > t.string :title > t.text :body > t.text :excerpt > t.datetime :created_at > t.datetime :updated_at > > t.timestamps > end > end > > def self.down > drop_table :papers > end > end > =================================> > What happening here...?Rails 2.0 puts timestamps in migrations by default, so you don''t need to specify created_at and updated_at fields. The rest of it looks just fine. - Martin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
le colibri
2007-Dec-30 18:36 UTC
Re: very strange behavior of script/generate ModelName field:type
On Dec 30, 7:13 pm, "Martin Svalin" <martin.sva...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Rails 2.0 puts timestamps in migrations by default, so you don''t need > to specify created_at and updated_at fields. > The rest of it looks just fine. > > - MartinThanks, Matin. I just looked it up in the PeepCode Rails 2 PDF. I just changed to Rails 2.0.2 and the syntax of the migration surprised me. One more question: how does one create a migration from the command line? E.g. what do I have to type instead of the old ''user_id:integer'', which is done now with ''t.reference :user'', or ''t.belongs_to :user'' Thanks, le colibri --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---