end def set_foo(val) set_attribute(:foo_name, val) end def set_bar(val) set_attribute(:bar_name, val.to_s) end def set_baz(val) set_attribute(:baz_name, val) end Saturday, April 6, 13
:special val = convert_val_for_special(val) end if type == :ordinal && val.is_a?(String) self.is_string = true end self.type = type self.state = :done self.val = val save end Bad Saturday, April 6, 13
do_ordinal_task(val) self.is_string = true if val.is_a?(String) persist_task(:ordinal, val) end def do_another_task persist_task(:another, val) end def persist_task(type, val) self.type = type self.state = :done self.val = val save end Saturday, April 6, 13
Page < GeneralContent # Uses: title, body, tags end class City < GeneralContent # Uses: title, body, coords end class Hotel < GeneralContent # Uses: title, coords, stars, tags end Saturday, April 6, 13