validates_length_of :description, :maximum => 1000, :allow_blank => true, :allow_nil => true
validates_length_of :column_layout, :maximum => 20, :allow_blank => false, :allow_nil => false
validates_uniqueness_of :name, :scope => :user_id
+ validates_inclusion_of :is_global, :in => [true, false]
before_destroy :check_not_default_before_destroy
class AddGlobalToDashboards < ActiveRecord::Migration
def self.up
- add_column 'dashboards', 'is_global', :boolean, :null => false
+ add_column 'dashboards', 'is_global', :boolean
+ Dashboard.update_all(Dashboard.sanitize_sql_for_assignment({:is_global => false}))
end
end