rails generate model User email:string password:string
creates the following migration script
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :email
t.string :password
t.timestamps
end
end
def self.down
drop_table :users
end
end
What is timestamps and why is it getting created, when I didn't ask it to be created?
This question came up in a search for "generate rails model without timestamps" so I wanted to add an answer on how to do that:
rails g model MyModel --no-timestamps
This works in Rails 3.2+.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With