NoMethodError:未定义的方法`sql_for_on_duplicate_key_update&#39;对于#<activerecord :: connectionadapters :: postgresqladapter:0xb73ddf8>

时间:2016-02-24 07:53:00

标签: ruby-on-rails postgresql activerecord-import

我有一个Rails应用程序,最近我将我的数据库从MySql更改为PostgreSql,从那时起,活动记录import方法:on_duplicate_key_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'

我正在跑步:

Rails version: 4.0.2
Ruby version: 2.0.0p643

0 个答案:

没有答案