Ruby on rails NoMethodError:未定义的方法'sql'用于\u复制\u键\u更新&\x27;对于#<;ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb73ddf8>;

Ruby on rails NoMethodError:未定义的方法'sql'用于\u复制\u键\u更新&\x27;对于#<;ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb73ddf8>;,ruby-on-rails,postgresql,activerecord-import,Ruby On Rails,Postgresql,Activerecord Import,我有一个Rails应用程序,最近我将我的数据库从MySql改为PostgreSql,从那时起,活动记录导入方法:on_duplicate\u key\u update抛出了一个错误 def import_of_products(import_links) Product.import import_links, :on_duplicate_key_update => [:ad_id] end 显示的错误是 NoMethodError: undefined method `sq

我有一个Rails应用程序,最近我将我的数据库从MySql改为PostgreSql,从那时起,活动记录
导入
方法
:on_duplicate\u key\u update
抛出了一个错误

def import_of_products(import_links)
  Product.import import_links, :on_duplicate_key_update => [:ad_id]   
end 
显示的错误是

NoMethodError: undefined method `sql_for_on_duplicate_key_update' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xab19f90>
from /home/mysystem/.rvm/gems/ruby-2.0.0-p643/gems/activerecord-import-0.4.1/lib/activerecord-import/adapters/abstract_adapter.rb:48:in `post_sql_statements'

重复密钥更新时的
是MySQL特有的功能。相当于博士后的学生是一名优等生。如何在Rails中实现upsert而“import_liks”是一个数组,我正在尝试进行批量插入。轨道上没有内置任何东西。您必须手动创建SQL查询:
Product.import.to_SQL+“ON CONFLICT DO UPDATE SET…”
@elmiyagnes您解决了吗?正如我所看到的,Postgres 9.5支持重复密钥更新。但我也有同样的错误我的Postgres版本是9.3.10
Rails version: 4.0.2
Ruby version: 2.0.0p643