hi, I am trying to create a new model by ruby script/model Personnel. But when I look into the personnel.rb there are no fields generated. Where should I check this problem? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 am trying to create a new model by ruby script/model Personnel. But > when I look into the personnel.rb there are no fields generated. Where > should I check this problem? >There won''t be any fields in the model file. Rails looks at your database table and figures out the structure dynamically. There should be a migration file to create a database table - you can specify columns there. And then look in mysql at the table you created. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks toby, I try to generate a scaffold and everything went well. What will be the purpose of specifying columns in the migration file? james On Jan 24, 4:35 am, "toby privett" <tobypriv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I am trying to create a new model by ruby script/model Personnel. But > > when I look into the personnel.rb there are no fields generated. Where > > should I check this problem?There won''t be any fields in the model file. Rails looks at your > database table and figures out the structure dynamically. > > There should be a migration file to create a database table - you can > specify columns there. And then look in mysql at the table you > created.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Migrations are a way for Rails to create the tables for you if you do not already have them. Very handy if you are starting from scratch, working with others or need to make schema changes during deployment/upgrades (especially when using Capistrano). Since migrations exist within Rails they have access to all you models/etc, so manipulating the data can be scripted and the logic captured. On Jan 24, 11:40 am, "james_027" <cai.hai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks toby, I try to generate a scaffold and everything went well. > > What will be the purpose of specifying columns in the migration file? > > james > > On Jan 24, 4:35 am, "toby privett" <tobypriv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I am trying to create a new model by ruby script/model Personnel. But > > > when I look into the personnel.rb there are no fields generated. Where > > > should I check this problem?There won''t be any fields in the model file. Rails looks at your > > database table and figures out the structure dynamically. > > > There should be a migration file to create a database table - you can > > specify columns there. And then look in mysql at the table you > > created.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks askegg. Very well explain On Jan 24, 9:24 am, "askegg" <andrew.sk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Migrations are a way for Rails to create the tables for you if you do > not already have them. > > Very handy if you are starting from scratch, working with others or > need to make schema changes during deployment/upgrades (especially when > using Capistrano). > > Since migrations exist within Rails they have access to all you > models/etc, so manipulating the data can be scripted and the logic > captured. > > On Jan 24, 11:40 am, "james_027" <cai.hai...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thanks toby, I try to generate a scaffold and everything went well. > > > What will be the purpose of specifying columns in the migration file? > > > james > > > On Jan 24, 4:35 am, "toby privett" <tobypriv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I am trying to create a new model by ruby script/model Personnel. But > > > > when I look into the personnel.rb there are no fields generated. Where > > > > should I check this problem?There won''t be any fields in the model file. Rails looks at your > > > database table and figures out the structure dynamically. > > > > There should be a migration file to create a database table - you can > > > specify columns there. And then look in mysql at the table you > > > created.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---