当我使用rails 5
运行以下命令时rails g model Profile name:string:index profileable:references{polymorphic}
我得到了这种奇怪的迁移
class CreateProfiles < ActiveRecord::Migration[5.0]
def change
create_table :profiles do |t|
t.string :name
t.referencesc :profileable
t.referencesh :profileable
t.referencesi :profileable
t.referencesl :profileable
t.referencesm :profileable
t.referenceso :profileable
t.referencesp :profileable
t.referencesr :profileable
t.referencesy :profileable
t.timestamps
end
add_index :profiles, :name
end
end
环境:OSX Sierra 10.12.2,Rails 5.0.1,ruby 2.3.3p222(2016-11-21修订版56859)[x86_64-darwin16]
答案 0 :(得分:2)
如果您正在运行Yadr
或其他任何内容(例如Prezto / Tmux),请尝试禁用这两者和/或通过终端运行迁移
答案 1 :(得分:1)
{}
显然会被您的shell扩展(括号扩展)。
用引号引起来:
rails g model Profile name:string:index "profileable:references{polymorphic}"