Hmm, I'm pretty baffled now. I manually edited 'vendor/rails/
activerecord/test/schema/schema.rb' and changed the declaration to:
create_table :events, :force => true do |t|
t.column :title, :nvarchar, :limit => 5
end
Once the tests were running, I confirmed, using SQL Server Management
Studio, that the column was indeed nvarchar. All good. However the
error still occurred. I then tried running the failing SQL "INSERT
INTO [events] ([title]) VALUES(N'一二三四五')" directly in SQLSMS and it
worked as expected.
--
Nick
On Sep 9, 3:06 pm, Nick Tidey <
nickti...@gmail.com> wrote:
> Now that I've been able to run the unit tests (against SQL Server
> 2008), I get one error, one failure:
>
> 1) Failure:
> test_named_scopes_honor_current_scopes_from_when_defined
> (NamedScopeTest)
> <[...Posts...]> expected to be != to <[...Posts...]>
>
> 2) Error:
> test_validate_uniqueness_with_limit_and_utf8(ValidationsTest):
> ActiveRecord::StatementInvalid: DBI::DatabaseError: 22001 (8152)
> [unixODBC][FreeTDS][SQL Server]String or binary data would be
> truncated.: INSERT INTO [events] ([title]) VALUES('一二三四五')
>
> Full output is here:
http://pastie.org/610635
>
> The schema used to set up the Rails ActiveRecord tests contains:
>
> create_table :events, :force => true do |t|
> t.string :title, :limit => 5
> end
>
> So I'm not surprised that error is cropping up. I'm curious how anyone
> is getting 100% success running these tests currently and if I'm doing
> anything wrong. My previous post described the steps I took to get
> this up and running:
>
>
http://groups.google.com/group/rails-sqlserver-adapter/browse_thread/...