reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2012-Mar-02 15:33 UTC
Starting my first application with Rails
Hi: I''m starting a simple application to learn Rails and Ruby of course. I come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some of them have a task to create DB models from existent database which is my case. I have a PostgreSQL database which want to use in my app. My question is: exists any rake or rails command to generate models if they exists in Rails? Ing. Reynier Perez Mira eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org Skype: reynierpm Mobile: +58 424.180.5609 Site: http://reynierpm.site90.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hi: > I''m starting a simple application to learn Rails and Ruby of course. I > come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some > of them have a task to create DB models from existent database which is my > case. I have a PostgreSQL database which want to use in my app. My question > is: exists any rake or rails command to generate models if they exists in > Rails? > > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com >A model can be generated using rails generate model MODELNAME field1:type field2:type ..... Javier Q. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2012-Mar-02 15:39 UTC
Re: Starting my first application with Rails
Thanks Javier and what about ID (PK) fields? Need to be specified too or Rails is smart enough to get them from tables? Ing. Reynier Perez Mira eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org Skype: reynierpm Mobile: +58 424.180.5609 Site: http://reynierpm.site90.com On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> Hi: >> I''m starting a simple application to learn Rails and Ruby of course. I >> come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some >> of them have a task to create DB models from existent database which is my >> case. I have a PostgreSQL database which want to use in my app. My question >> is: exists any rake or rails command to generate models if they exists in >> Rails? >> >> Ing. Reynier Perez Mira >> eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >> Skype: reynierpm >> Mobile: +58 424.180.5609 >> Site: http://reynierpm.site90.com >> > > > A model can be generated using > > rails generate model MODELNAME field1:type field2:type ..... > > > > Javier Q. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2012-Mar-02 15:41 UTC
Re: Starting my first application with Rails
Also can my tables be named in singular or all needs to be plural? I''m reading conventions right now but have this doubt. For example if I have a table called record the correct name for the model could be Record << ActiveRecord::Base? Ing. Reynier Perez Mira eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org Skype: reynierpm Mobile: +58 424.180.5609 Site: http://reynierpm.site90.com On Fri, Mar 2, 2012 at 11:09 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Thanks Javier and what about ID (PK) fields? Need to be specified too or > Rails is smart enough to get them from tables? > > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> >> >> On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> > wrote: >> >>> Hi: >>> I''m starting a simple application to learn Rails and Ruby of course. I >>> come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some >>> of them have a task to create DB models from existent database which is my >>> case. I have a PostgreSQL database which want to use in my app. My question >>> is: exists any rake or rails command to generate models if they exists in >>> Rails? >>> >>> Ing. Reynier Perez Mira >>> eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >>> Skype: reynierpm >>> Mobile: +58 424.180.5609 >>> Site: http://reynierpm.site90.com >>> >> >> >> A model can be generated using >> >> rails generate model MODELNAME field1:type field2:type ..... >> >> >> >> Javier Q. >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 2, 2012, at 10:39 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Thanks Javier and what about ID (PK) fields? Need to be specified too or Rails is smart enough to get them from tables?To be clear, the instructions that Javier gave you are to create a new table and model to match, not to introspect an existing database table and infer a model from it. This instruction is precisely how you create a new model when starting a green-field Rails application. To answer your follow up question, yes, Rails will add id, created_at and updated_at columns (int-11, datetime, datetime) automagically. You can certainly follow these steps (and be sure to issue the --skip-migrations flag at the end so you don''t end up with a redundant migration file) but I don''t think this is actually the answer you were looking for. I don''t have one for you either, sorry, but I didn''t want you to go down this path and get confused when it didn''t do what you asked for. Walter> > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Hi: > I''m starting a simple application to learn Rails and Ruby of course. I come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some of them have a task to create DB models from existent database which is my case. I have a PostgreSQL database which want to use in my app. My question is: exists any rake or rails command to generate models if they exists in Rails? > > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > A model can be generated using > > rails generate model MODELNAME field1:type field2:type ..... > > > > Javier Q. > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
When you generate for example rails generate model Projects name:string it will generate a table id name created_at updated_at and as you see I named it PROJECTS but rails is smart enough to change it into PROJECT =) You should give this tutorial a try http://ruby.railstutorial.org/ and also http://railsforzombies.org/ Hope that helps Javier Q. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 2, 2012, at 10:41 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Also can my tables be named in singular or all needs to be plural? I''m reading conventions right now but have this doubt. For example if I have a table called record the correct name for the model could be Record << ActiveRecord::Base?You can certainly override the conventions, but it''s going to be messy. Particularly if you do something like tell Rails that the plural of record is record. The conventions are there to remove needless configuration. Walter> Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > On Fri, Mar 2, 2012 at 11:09 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Thanks Javier and what about ID (PK) fields? Need to be specified too or Rails is smart enough to get them from tables? > > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Hi: > I''m starting a simple application to learn Rails and Ruby of course. I come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some of them have a task to create DB models from existent database which is my case. I have a PostgreSQL database which want to use in my app. My question is: exists any rake or rails command to generate models if they exists in Rails? > > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > A model can be generated using > > rails generate model MODELNAME field1:type field2:type ..... > > > > Javier Q. > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 March 2012 15:41, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Also can my tables be named in singular or all needs to be plural? I''m > reading conventions right now but have this doubt. For example if I have a > table called record the correct name for the model could be Record << > ActiveRecord::Base?You can do that sort of thing (see set_table_name), however I strongly suggest that first you work right through a good tutorial such as railstutorial.org (which is free to use online) in order to get a grasp of the basics. Rails relies for much of its magic on sticking to the conventions. It /is/ possible to circumvent them but life is much easier if you can avoid it. If you google for rails legacy database you will find a lot of useful stuff, but again if you can possibly change the db schema to match rails conventions then do that. Colin> > Ing. Reynier Perez Mira > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > Skype: reynierpm > Mobile: +58 424.180.5609 > Site: http://reynierpm.site90.com > > > On Fri, Mar 2, 2012 at 11:09 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> >> Thanks Javier and what about ID (PK) fields? Need to be specified too or >> Rails is smart enough to get them from tables? >> >> Ing. Reynier Perez Mira >> eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >> Skype: reynierpm >> Mobile: +58 424.180.5609 >> Site: http://reynierpm.site90.com >> >> >> On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >>> >>> >>> >>> On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >>> <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>>> Hi: >>>> I''m starting a simple application to learn Rails and Ruby of course. I >>>> come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some >>>> of them have a task to create DB models from existent database which is my >>>> case. I have a PostgreSQL database which want to use in my app. My question >>>> is: exists any rake or rails command to generate models if they exists in >>>> Rails? >>>> >>>> Ing. Reynier Perez Mira >>>> eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org >>>> Skype: reynierpm >>>> Mobile: +58 424.180.5609 >>>> Site: http://reynierpm.site90.com >>> >>> >>> >>> A model can be generated using >>> >>> rails generate model MODELNAME field1:type field2:type ..... >>> >>> >>> >>> Javier Q. >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en.-- gplus.to/clanlaw -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2012-Mar-02 20:18 UTC
Re: Starting my first application with Rails
@Javier: Thanks for your clarifications it''s a bit clear to me now @Colin: I can do that without problem because I''m starting the application so maybe I could create models from scratch using Rails but what about fixtures? I''ve a table country and will be nice if I can populate the table with 238 records :) @Walter: Understood but what about relations? How to deal with this from rails command line? I have relations BelongsTo (record belongs to country) and hasMany (record hasMany attachment and some others) Thanks to every Ing. Reynier Perez Mira eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org Skype: reynierpm Mobile: +58 424.180.5609 Site: http://reynierpm.site90.com On Fri, Mar 2, 2012 at 11:17 AM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>wrote:> > On Mar 2, 2012, at 10:41 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > > Also can my tables be named in singular or all needs to be plural? I''m > reading conventions right now but have this doubt. For example if I have a > table called record the correct name for the model could be Record << > ActiveRecord::Base? > > You can certainly override the conventions, but it''s going to be messy. > Particularly if you do something like tell Rails that the plural of record > is record. The conventions are there to remove needless configuration. > > Walter > > > Ing. Reynier Perez Mira > > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > Skype: reynierpm > > Mobile: +58 424.180.5609 > > Site: http://reynierpm.site90.com > > > > > > On Fri, Mar 2, 2012 at 11:09 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < > reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thanks Javier and what about ID (PK) fields? Need to be specified too or > Rails is smart enough to get them from tables? > > > > Ing. Reynier Perez Mira > > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > Skype: reynierpm > > Mobile: +58 424.180.5609 > > Site: http://reynierpm.site90.com > > > > > > On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > On Fri, Mar 2, 2012 at 10:33 AM, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < > reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi: > > I''m starting a simple application to learn Rails and Ruby of course. I > come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some > of them have a task to create DB models from existent database which is my > case. I have a PostgreSQL database which want to use in my app. My question > is: exists any rake or rails command to generate models if they exists in > Rails? > > > > Ing. Reynier Perez Mira > > eMail: reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, reynierpm-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org > > Skype: reynierpm > > Mobile: +58 424.180.5609 > > Site: http://reynierpm.site90.com > > > > > > A model can be generated using > > > > rails generate model MODELNAME field1:type field2:type ..... > > > > > > > > Javier Q. > > > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 2 March 2012 20:18, reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <reynierpm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @Javier: Thanks for your clarifications it''s a bit clear to me now > @Colin: I can do that without problem because I''m starting the application > so maybe I could create models from scratch using Rails but what about > fixtures? I''ve a table country and will be nice if I can populate the table > with 238 records :)As I suggested previously, work through railstutorial.org and it will introduce you to a variety of techniques including testing options. Fixtures are not considered the best way of testing by most developers now.> @Walter: Understood but what about relations? How to deal with this from > rails command line? I have relations BelongsTo (record belongs to country) > and hasMany (record hasMany attachment and some others)The same goes here, work through the tutorial and you will be able to answer basic questions yourself. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.