2011-10-31 27 views
0

你好,我已經架式遷移,一切都很好,但是當我rake db:migrate我得到外殼上的以下錯誤信息:遷移未定義的局部變量或方法'T」

== CreateClients: migrating ================================================== 
-- create_table(:clients) 
--  t() 
rake aborted! 
An error has occurred, this and all later migrations canceled: 

undefined local variable or method ` t' for #<CreateClients:0x00000102a5a7c8> 

Tasks: TOP => db:migrate 

這裏是在遷移文件DB /遷移目錄:

# encoding: UTF-8 

class CreateClients < ActiveRecord::Migration 
    def self.up 
    create_table :clients do |t| 
     t.string :name 
     t.string :adress 
     t.integer :telephone 
     t.string :email 
     t.text :comments 
     t.timestamps 
    end 
    end 

    def self.down 
    drop_table :clients 
    end 
end 

任何人幫助嗎?

+0

是這個導軌2.3.x版本或3.x版 – topek

+4

發佈完整的錯誤的機會嗎?這可能是導致Active Record無法按預期運行的寶石問題。上面的代碼片段看起來很好。 –

+0

它的導軌3.1.1。 Ben按照Ben的要求添加了完整的消息錯誤。 – blawzoo

回答

1

我以前也有過這個相同的錯誤。你在使用Devise嗎?如果是這樣,請嘗試添加:

t.confirmable 

這就解決了我的問題。

,並在運行遷移將這些字段添加到數據庫:

confirmed_at :datetime 
confirmation_token :string 
confirmation_sent_at :datetime 
+0

非常感謝Hopstream,我不使用設計,但是這個答案解決了問題 – blawzoo

+0

也許不是直接的,但是你使用的寶石之一很可能依賴於它進行驗證。 – Hopstream

+0

我會試圖找出它是哪個寶石。 – blawzoo

相關問題