Skip to content

Instantly share code, notes, and snippets.

@0xdevalias
Last active December 18, 2015 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xdevalias/5790864 to your computer and use it in GitHub Desktop.
Save 0xdevalias/5790864 to your computer and use it in GitHub Desktop.
Things I learned the hard way with Rails # 1. Generate your model, make all manual edits, and only AFTER you have done this, run rake db:migrate
rails g model identity name:string email:string password_digest:string
class CreateIdentities < ActiveRecord::Migration
def change
create_table :identities do |t|
t.string :name
t.string :email
t.string :password_digest
t.timestamps
end
end
end
class CreateIdentities < ActiveRecord::Migration
def change
create_table :identities do |t|
t.string :name, :null => false
t.string :email, :null => false
t.string :password_digest, :null => false
t.timestamps
end
end
end
rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment