2009-12-08 119 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

相关问题