Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – Foreigner :: ConnectionAdapters :: ForeignKeyDefinition的未定义方法`column’大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试运行迁移时,我得到以下内容:
NoMethodError: undefined method `column' for #<Foreigner::ConnectionAdapters::ForeignKeyDefinition:0x007fa020938740>

以下是迁移代码:

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

我有外国人1.6.1安装,Rails 4.2.0.有任何想法吗?

解决方法

@H_607_13@ 您或您的宝石之一使用“外国人”宝石,它已被rails 4.2.0弃用

您应该更新它或删除此依赖关系.
也许有人已经做了,例如我使用’邮箱’的宝石,’github.com/div’已经分配了项目来创建一个分支,所以我改变了我的Gemfile:

gem 'mailboxer',:git => 'git://github.com/div/mailboxer.git',:branch => 'rails42-foreigner'

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails – Foreigner :: ConnectionAdapters :: ForeignKeyDefinition的未定义方法`column’全部内容,希望文章能够帮你解决ruby-on-rails – Foreigner :: ConnectionAdapters :: ForeignKeyDefinition的未定义方法`column’所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。