Difference with :null

Which is the difference between *:null => true* and *:default => nil*?

If a field is going to be optional, which option of those would be the
best?
*t.string :optional, :null => true*
or
*t.string :optional, default => nil*

Which is the difference between *:null => true* and *:default => nil*?

:null => true/false is whether the column is not null or not. At least on my version of mysql, the default is that null is allowed.
:default => nil says that the default value for the column is null (which is the default).

If a field is going to be optional, which option of those would be the
best?
*t.string :optional, :null => true*

or
*t.string :optional, default => nil*

t.string :optional, :null => true corresponds to what you actually want. You probably don't need :null => true since I believe it's the default

Fred