3

Rails 3.2.8、デバイス 2.1.2 を実行しています。

移行に空白のデフォルトが含まれていることに気付きました:

class DeviseCreateUsers < ActiveRecord::Migration
  def change
    create_table(:users) do |t|
      ## Database authenticatable
      t.string :email,              :null => false, :default => ""
      t.string :encrypted_password, :null => false, :default => ""
      ......

しかし、その schema.rb には別のものが含まれています。

  create_table "users", :force => true do |t|
    t.string   "email",                  :default => "''''", :null => false
    t.string   "encrypted_password",     :default => "''''", :null => false
    .....

そして、これらのデフォルトは''''、登録フォームなどに表示されます。なぜこれが起こるのですか? これらのデフォルトを別の移行で変更するリスクはありますか?

4

1 に答える 1

0

問題なくデフォルトを変更できると思います。

私のschema.rbファイルの1つに次の行があります(これはうまく機能していると思います):

  create_table "users", :force => true do |t|
    t.string   "email",                               :default => "", :null => false
    t.string   "encrypted_password",   :limit => 128, :default => "", :null => false
于 2012-09-18T17:46:25.510 に答える