Browse files

Remove a few custom Types' defaults to re-enable standard nil "defaul…

…t value" behavior

DataMapper explicitly disallows :default => nil in class property declarations.  When a
DataMapper custom Type declares a non-nil default, there is no way to get nil property
values "by default" upon object creation - they have to be set explicitly every time.

This flies against long-standard DB and DM convention, where declared fields are nullable
by default unless explicitly specified otherwise (SQL: NOT NULL, DM: :required => true).
This is also true of the Salesforce object model.

If default values are desired, they should be expressed via class property declarations,
not underlying Type.  Maybe validation behavior should be considered separately?
  • Loading branch information...
jpr5 authored and atmos committed Mar 24, 2010
1 parent 5991f5c commit 0a6b885a0eb0d7f50b88f98451b859126114fa5f
Showing with 0 additions and 3 deletions.
  1. +0 −1 lib/dm-salesforce/types/boolean.rb
  2. +0 −1 lib/dm-salesforce/types/float.rb
  3. +0 −1 lib/dm-salesforce/types/integer.rb
@@ -4,7 +4,6 @@ class Boolean < Type
primitive Integer
TRUE = 1
- default false
def self.dump(value, property)
case value
@@ -2,7 +2,6 @@ module DataMapper::Salesforce
module Types
class Float < Type
primitive ::Float
- default 0.0
@@ -2,7 +2,6 @@ module DataMapper::Salesforce
module Types
class Integer < Type
primitive ::Integer
- default 0
def self.load(value, property)

0 comments on commit 0a6b885

Please sign in to comment.