When I need a default value for a ActiveRecord attribute often I will resort to using a plugin. But in reality, initializing an attribute in the #after_initialize callback is often the simplest thing that works:
1 2 3 4 5 | class Tweet def after_initialize self .message ||= "I'm Tweeting" end end |