I setup a migration with a table that has a default value and can not be
null.
create_table( :user ) do |t|
t.column( :first_name, :string, {null => false} )
t.column( :last_name, :string, {null => false} )
t.column( :email_address, :string, {null => false} )
t.column( :last_login, :datetime, {:default => ‘now()’, :null =>
false} )
end
It creates the table. If I view it from within mysql, It has the
default value. However, when I go to create a record it fails.
User.create( :first_name => “first”,
:last_name => “last”,
:email_address => “[email protected]” )
I see that the sql statement rails makes sets last_login to NULL. How
can I get rails to use the default value in this situation?
Thanks!
Chris