I'm confused about the usage of 'validates_presence_of' and the 'default' parameter of the 'column' method. Let's say I have a model that looks something like this:
class CreateErrorTypes < ActiveRecord::Migration def self.up create_table :error_types do |t| t.column :description, :string, :limit => 254, :null => false t.column :can_delete, :boolean, :null => false, :default => false end end def self.down drop_table :error_types end end
class ErrorType < ActiveRecord::Base validates_presence_of :description validates_presence_of :can_delete end
Then in console I do this:
>> ErrorType.create(:description => "General error")
What I expect is an ErrorType object with can_delete set to false, but what I get is an error saying that can_delete "can't be blank". Why isn't it setting the default value of that field to false??