Re: [Rails] A Question about Model and Database?

2012-09-08 Thread Colin Law
On 7 September 2012 22:08, ACK wrote: > hi i m new to rails i need to know the => which is the best way to create > Database table in Rails? > > 1) rails generate model User name:string email:string > this will create a migration file with something like this > > class CreateUsers < ActiveRecord::

Re: [Rails] A Question about Model and Database?

2012-09-08 Thread ANIKET KADAM
thanks for reply On Sat, Sep 8, 2012 at 9:55 AM, Javier Quarite wrote: > Rails is smart enough to determine if you want to create or drop a table > if you have done the migration with change > def change > #code here > end > > it only depends on how you write the commands > if you do > rake

Re: [Rails] A Question about Model and Database?

2012-09-08 Thread Fahim Patel
use def change forget up and down def cheers Fahim Babar Patel On Sat, Sep 8, 2012 at 9:55 AM, Javier Quarite wrote: > Rails is smart enough to determine if you want to create or drop a table > if you have done the migration with change > def change > #code here > end > > it only depends on h

Re: [Rails] A Question about Model and Database?

2012-09-07 Thread Javier Quarite
Rails is smart enough to determine if you want to create or drop a table if you have done the migration with change def change #code here end it only depends on how you write the commands if you do rake db:migrate then it will create the db (if the code inside change is about it) and if you do

Re: [Rails] A Question about Model and Database?

2012-09-07 Thread ANIKET KADAM
please help me On Sat, Sep 8, 2012 at 2:38 AM, ACK wrote: > hi i m new to rails i need to know the => which is the best way to create > Database table in Rails? > > 1) *rails generate model User name:string email:string* > this will create a migration file with something like this > > class Cre

[Rails] A Question about Model and Database?

2012-09-07 Thread ACK
hi i m new to rails i need to know the => which is the best way to create Database table in Rails? 1) *rails generate model User name:string email:string* this will create a migration file with something like this class CreateUsers < ActiveRecord::Migration def change create_table :users d