@@ -29,11 +29,11 @@ def initialize(column_hash = nil)
2929 column_type = Base . column_type ( @column_hash ) || 'nil'
3030 default_value_method = "build_default_value_for_#{ column_type } "
3131 @object = __send__ default_value_method
32- rescue ::Exception
32+ rescue ::Exception => e
3333 end
3434
3535 def build_default_value_for_nil
36- @column_hash [ :default ] || nil
36+ @column_hash . key? ( :default ) ? @column_hash [ :default ] : nil
3737 end
3838
3939 def build_default_value_for_datetime
@@ -56,23 +56,23 @@ def build_default_value_for_date
5656 end
5757
5858 def build_default_value_for_boolean
59- @column_hash [ :default ] || false
59+ @column_hash . key? ( :default ) ? @column_hash [ :default ] : false
6060 end
6161
6262 def build_default_value_for_float
63- @column_hash [ :default ] || Float ( 0.0 )
63+ @column_hash . key? ( :default ) ? @column_hash [ :default ] : Float ( 0.0 )
6464 end
6565
6666 alias build_default_value_for_decimal build_default_value_for_float
6767
6868 def build_default_value_for_integer
69- @column_hash [ :default ] || Integer ( 0 )
69+ @column_hash . key? ( :default ) ? @column_hash [ :default ] : Integer ( 0 )
7070 end
7171
7272 alias build_default_value_for_bigint build_default_value_for_integer
7373
7474 def build_default_value_for_string
75- @column_hash [ :default ] || ''
75+ @column_hash . key? ( :default ) ? @column_hash [ :default ] : ''
7676 end
7777
7878 alias build_default_value_for_text build_default_value_for_string
0 commit comments