2009-12-08 134 views
0
(in /Users/sayedgamal/apps/test) 
/Users/sayedgamal/apps/test/config/boot.rb:20:Warning: Gem::SourceIndex#search support for String patterns is deprecated 
== CreatePeople: migrating ==================================================== 
-- create_table(:people) 
rake aborted! 
undefined method `string' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x238e97c> 

(See full trace by running task with --trace) 

我得到當我發出紅寶石未定義的方法(個),活動記錄

耙分貝的錯誤:遷移

命令..在根文件夾我的Rails項目..的

migrate/001_create_people.rb contents : 
class CreatePeople < ActiveRecord::Migration 
    def self.up 
    create_table :people do |t| 
    t.string :first_name 
    t.string :second_name 
    t.string :company 
    t.string :email 
    t.string :phone 
    end 
    end 

    def self.down 
    drop_table :people 
    end 
end 

注意:我還使用了整數和文本字段,並沒有基於遷移類型的工作.. 錯誤總是更改爲未定義的數據類型{字符串,整數,文本,...} 文件..! 注意:我在應用程序的根文件夾中使用rake db:migrate。

回答

2

檢查您的導軌版本。當Sexy Migrations插件被合併到核心時,這個「t.string」語法就出現了。如果無法升級到最新版本,則應使用

t.column :first_name, :string 

語法。

+2

它絕對是,看看移民號碼。我認爲這兩個成語在同一時間都發生了變化。 – Swanand 2009-12-08 10:59:49

相關問題