当我尝试运行迁移时,我得到以下内容:
NoMethodError: undefined method `column' for #<Foreigner::ConnectionAdapters::ForeignKeyDefinition:0x007fa020938740>
Run Code Online (Sandbox Code Playgroud)
这是迁移代码:
class CreateAdvertisement < ActiveRecord::Migration
def change
create_table :advertisement do |t|
t.integer :issue_id, null: false
t.string :client_name, null: false
t.decimal :size, null: false
t.decimal :price, null: false
t.decimal :commission_amount, null: false
t.string :first_payment, null: false
t.string :second_payment, null: false
t.timestamps null: false
t.foreign_key :issue
end
end
end
Run Code Online (Sandbox Code Playgroud)
我安装了Foreigner 1.6.1,Rails 4.2.0.有任何想法吗?
Nic*_*vre 23
你或你的一个宝石使用'外国人'宝石,它已被rails 4.2.0弃用
您应该更新它或删除此依赖项.也许有人已经做过了,例如我使用'mailboxer'宝石,'github.com/div'已经分叉了项目来创建一个分支,所以我改变了我的Gemfile:
gem 'mailboxer', :git => 'git://github.com/div/mailboxer.git', :branch => 'rails42-foreigner'
Run Code Online (Sandbox Code Playgroud)
els*_*udo 18
你不需要外国人使用Rails 4.2,因为它已经内置了外键支持.外国人的语法非常相似(尽管不完全相同).
请参阅:http://edgeguides.rubyonrails.org/4_2_release_notes.html#foreign-key-support
归档时间: |
|
查看次数: |
3900 次 |
最近记录: |