public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fixed that create database statements would always include "DEFAULT NULL" (Nick 
Sieger) [#334 status:committed]
dhh (author)
Mon Jul 14 08:12:54 -0700 2008
commit  30370227890dc950f1544b7b1040aa75e505f877
tree    06f1b423c32d55ea7ff7f4ff0108adbb52ff9713
parent  0176e6adb388998414083e99523de318d3b8ca49
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334]
0
+
0
 * Add :accessible option to associations for allowing (opt-in) mass assignment. #474. [David Dollar] Example :
0
 
0
   class Post < ActiveRecord::Base
...
257
258
259
260
 
 
 
 
261
262
263
...
257
258
259
 
260
261
262
263
264
265
266
0
@@ -257,7 +257,10 @@ module ActiveRecord
0
 
0
       def to_sql
0
         column_sql = "#{base.quote_column_name(name)} #{sql_type}"
0
-        add_column_options!(column_sql, :null => null, :default => default) unless type.to_sym == :primary_key
0
+        column_options = {}
0
+        column_options[:null] = null unless null.nil?
0
+        column_options[:default] = default unless default.nil?
0
+        add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key
0
         column_sql
0
       end
0
       alias to_s :to_sql

Comments