I tried creating a DB migration in Rails that looked something like this:
ruby script/generate scaffold post user_id:int title:string content:text
Looking at the resulting .rb file, sure enough, I saw everything I'd entered:
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.int :user_id # there it is: user_id
t.string :title
t.text :content
t.timestamps
end
end
def self.down
drop_table :posts
end
end
But after running rake db:migrate
and inspecting my database, I see that no user_id
column was created. What happened, here?