[Rails] Re: RoR data models ( extreme newbie question)
Martyn Bedford
martyn.bedford at greenhatconsulting.com
Wed Jul 26 12:31:23 GMT 2006
Phil Peterman wrote:
> Hi Martyn,
>
> The new way of creating db tables is to use migrations, but before we
> walk down that road, let me tell ya about the old way, which still works
> just fine.
>
> Tables are always the plural name of the models they represent, so if
> you are going to have a user model then you have to have a users table
> and if you are going to have a product model you would name your db
> table products.
>
> In order to make your life easier, and being the lazy programmer I am, I
> love easier, each table needs to have a primary key called id which is
> auto increment, an amazing ammount of rails automagic depends on this
> tiny step.
>
> You can cruise on over to:
> http://www.ocf.berkeley.edu/~jday/wiki/index.php?DevelopmentEnvironment
>
> and that should fill you in. Hope this helps.
>
> Phil
Thanks everyone for your answers, as with any answer it invenitably
leads to another question.
So if I have my object I create a table called object(s) and create a
primary key called id, so good so far, now what I need to do is create
joins and foriegn keys to other tables, I have seen this working in a
few examples but I am lost as to the naming conventions for this.
Martyn
--
Posted via http://www.ruby-forum.com/.
More information about the Rails
mailing list