Ar-extensions import - on_duplicate_key_update error

This works perfectly the first time i run the script and every row gets inserted. But when ran a second time, when the code should update duplicate table rows instead of inserting, then this error appears (first object in the array):

[code]Mysql::Error: #23000Duplicate entry 'One Tree Hill' for key 'show_must_be_unique'[/code]

Lets go through the code real quick..

[code]class CreateShows < ActiveRecord::Migration   def self.up     create_table :shows do |t|       t.string :name       t.string :url       t.string :genre       t.datetime :start_year       t.datetime :end_year

      t.timestamps     end                 add_index(:shows, [:name], :unique => true, :name => "show_must_be_unique")   end

  def self.down     drop_table :shows   end end[/code]

[quote] require "ar-extensions"    require "hpricot"    require "open-uri"

   def index

     @columns = [        :name,        :url,        :genre,        :start_year,        :end_year      ]      @values = scrape_shows() #returns a correct array with Show objects      @options = {:validate => false, :on_duplicate_key_update => [:url, :start_year, :end_year]}

     Show.import @columns, @values, @options      @values.clear

     @shows = Show.find(:all)      respond_to do |format|        format.html #index.html.erb      end

   end [/quote]

I've google around alot for any solution with no luck.

My friend introduced me to AR-extensions and he simply gave me this code, which run fine for him, then of course we don't have the same setup.

Anyone have experience with AR-extensions on Windows? I'm running: Ruby 1.8.6 Rails 2.1.0 Mongrel 1.1.5 AR-extensions 0.8.0 (yes, with MySQL)

Somehow the code won't recognize a duplicate and still tries to do an INSERT instead of an UPDATE.