0

我的用户迁移过去看起来像这样:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :login
      etc

现在看起来像这样:

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :username
      etc

那么,为什么我会看到这个?

rake db:drop
rake db:create
rake db:migrate
rails console
> User.new
+----+-------+------------------+---------------+-------------------+------------+------------+
| id | login | crypted_password | password_salt | persistence_token | created_at | updated_at |
+----+-------+------------------+---------------+-------------------+------------+------------+
|    |       |                  |               |                   |            |            |
+----+-------+------------------+---------------+-------------------+------------+------------+
1 row in set

我正在使用 PostgreSQL。

4

1 回答 1

0

增加用户迁移的文件名解决了这个问题。当我尝试更改其内容而不更改文件名时,我认为 Rails 正在缓存迁移的内容。

于 2012-10-19T06:18:15.353 回答