I know that something similar could be done at the database schema
level, but I wonder if this is the right way to give an ActiveRecord
model a defaulted attribute:
class Person < ActiveRecord::Base
write_attribute(:name, ‘John D.’) if read_attribute(:name).blank?
It seems to work, meaning:
new_person = Person.new
But I’m a bit suspicious that there is a better/safer way that I