I have an active record class
  class Service_Catalogue < ActiveRecord::Base
    set_table_name  "service_catalogue"
    set_primary_key "myKey"
  end
myKey is an nvarchar (sql server).
When I try and save it
  service_catalogue= Service_Catalogue.new()
  service_catalogue.myKey = "somevalue"
  service_catalogue.save
I get the following error:
  IDENTITY_INSERT could not be turned OFF for table [service_catalogue] (ActiveRecord::ActiveRecordError)
It seems like ActiveRecord thinks that the primary key is an identity column (it's not its a varchar) and so is failing.
Is there a way to tell it not to try and turn off identity insert?
UPDATE
It turns out the version of the active record sql server adapter was to blame. I had previously been using 1.0.0.9250 but somehow 2.2.19 got installed (I presume when doing a gem update). After reverting to the old version it works fine.