我在 rails 3.2.7 jruby 1.6.7.2 (ruby-1.9.2-p312) 上使用 sql server 2008 jruby
下表
create_table "Users", :primary_key => "id" do |t|
t.integer "id", :limit => 19, :default => 1, :null => false
t.string "login", :limit => 80, :null => false
t.binary "password"
end
当我用数据填充表时,我可以毫无问题地拉回记录。当我尝试保存时,出现以下错误:
Failure/Error: @user.save!
ActiveRecord::StatementInvalid:
ActiveRecord::JDBCError: Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.: INSERT INTO [Users] ( [login], [password]) VALUES ( N'user', '')