Created
October 29, 2015 20:26
-
-
Save nicholasjhenry/ccd6420b3cc19e4d9b09 to your computer and use it in GitHub Desktop.
Overcoming Our Obsession with Stringly-Typed Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Address < ActiveRecord::Base | |
| serialize :zip_code, ZipCode | |
| end | |
| class ZipCode | |
| def self.load(raw_string) | |
| self.new(raw_string) | |
| end | |
| def self.dump(zip_code) | |
| zip_code.to_str | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment