Setting Unicode Types As Default Issues

48 views
Skip to first unread message

José González Quintana

unread,
Aug 17, 2012, 5:59:35 PM8/17/12
to rails-sqlse...@googlegroups.com
I followed the instruccions from here https://github.com/rails-sqlserver/activerecord-sqlserver-adapter#setting-unicode-types-as-default

I wanted to disable the Unicode Types, so i added this to my initializers
# Disabled
ActiveRecord::ConnectionAdapters::SQLServerAdapter.enable_default_unicode_types = false
ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_text_database_type = 'varchar(max)'
ActiveRecord::ConnectionAdapters::SQLServerAdapter.native_string_database_type = 'varchar'

The strings gets varchar(255) but the text fields gets nvarchar(max) and i'm having encoding issues with the nvarchar type.

I don't know why the native_text_database property isn't working

Thanks in advance
Greetings
Jose

Ken Collins

unread,
Aug 17, 2012, 6:15:37 PM8/17/12
to rails-sqlse...@googlegroups.com

You only need to set the #enable_default_unicode_types to false and the others will be done for you.

Also, where are you setting these? It should work fine if you set them in an initializer.

 - Ken
Reply all
Reply to author
Forward
0 new messages