Hi all, please look to my example code:
the model:
class ProductCategory < ActiveRecord::Base
validates_uniqueness_of :name
validates_presence_of :name
end
and run this:
category = ProductCategory.new
puts category.name
puts category.name.blank?
puts category.name.class
puts nil.class
puts category.valid?
it will return:
NULL
false
String
NilClass
false
true
and I’m using sqlserveradapter in database.yml:
development:
database: xxx
adapter: sqlserver
host: .
username: xxx
password: xxx
I checked this page
http://dev.rubyonrails.org/attachment/ticket/7083/allow_sqlserver_to_save_strings_containing_null.diff
and rolled back this change,
and this problem has solved for me.
did anyone got the same problem?