rails-sqlserver/activerecord-sqlserver-adapter — Issue #163: N'xxx' prefix missing on text columns
Author: PhilT
Created: 2012-02-15 10:53:22+00:00
State: open

I'm running activerecord-sqlserver-adapter version 3.0.19 on Rails 3.0.10 with tiny_tds 0.5.0 (locally compiled). I'm having problems adding Unicode data to text columns as it's trying to insert it without the N prefix. I've checked the database and it is set to an nvarchar(max) and I have the lines setup in the initializer to enable Unicode types:

ActiveRecord::ConnectionAdapters::SQLServerAdapter.enable_default_unicode_types = true
ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'nvarchar(max)'
ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_string_database_type = 'nvarchar'

Am I missing something?