我是 Rails 的新手;我的问题是:我有一个用户表,我需要添加更多字段......
我把它放在哪里?我试图把它放在迁移文件中,但是当我运行rake db:migrate
.
这是在我的迁移文件中:
def self.up
create_table :users do |t|
t.string :username, :null => false # if you use another field as a username, for example email, you can safely remove this field.
t.string :email, :default => nil # if you use this field as a username, you might want to make it :null => false.
t.string :crypted_password, :default => nil
t.string :salt, :default => nil
t.string :nombres, :default => nil
t.string :apellidos, :default => nil
t.string :codigo, :default => nil
t.string :fecha, :default => nil
t.string :zona, :default => nil
t.string :institucion, :default => nil
t.string :frecuencia, :default => nil
t.string :pregunta, :default => nil
t.string :respuesta, :default => nil
t.timestamps
end
并且架构仍然没有新字段
create_table "users", :force => true do |t|
t.string "username", :null => false
t.string "email"
t.string "crypted_password"
t.string "salt"
t.string "nombres"
t.string "apellidos"
t.string "codigo"
t.string "fecha"
t.string "zona"
t.string "institucion"
t.string "frecuencia"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "remember_me_token"
t.datetime "remember_me_token_expires_at"
end
我应该怎么办?