In rails 3.1, we can validate presence of a field in model with:
validates :name, :presence => true
In db migration file, we also can do
t.string :name, :null => false
It seems that validates checks the data integrity before saving which is better. However db check up only happens during the saving process which may have started actual saving before aborting. Is validates in model better? Thanks so much.