Default Values for Blank Values OO-style
class Object def or_if_blank(value) self.respond_to?(:blank) && self.blank? ? value : self end end name.or_if_blank("John Doe")
DZone Snippets > bjh5537 > rails
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Rails Garden http://www.railsgarden.com/
class Object def or_if_blank(value) self.respond_to?(:blank) && self.blank? ? value : self end end name.or_if_blank("John Doe")