JRuby

jdbc_postgre.rb issue handling nil booleans

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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 :
    1

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 ?

Activity

Hide
Thomas E Enebo added a comment -

Fixed in commit d6563d3. I also fixed this in hsql/h2 along with two simple tests.

Show
Thomas E Enebo added a comment - Fixed in commit d6563d3. I also fixed this in hsql/h2 along with two simple tests.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: