Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Darwin woot.local 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386
-
Patch Submitted:Yes
-
Number of attachments :
Description
Problem
=========
When no default is chosen for a boolean value in an AR migration, MRI defaults the columns default value to nil, but the jdbc postgres
adapter is defaulting it to false.
Solution
=========
Return nil instead of false for explicitly nil values
Example
=========
class CreateStuffs < ActiveRecord::Migration
def self.up
create_table :stuffs { |t| t.boolean :is_awesome }
end
end
end
MRI
=========
>> Stuff.new
=> #<Stuff id: nil, is_awesome: nil >
JRuby
=========
>> Stuff.new
=> #<Stuff id: nil, is_awesome: false >
Wasn't sure which test case to include this in. test/jdbc_adapter/jdbc_postgre_test.rb doesn't exist... so should one be started ?
Fixed in commit d6563d3. I also fixed this in hsql/h2 along with two simple tests.