Created
August 27, 2014 15:49
-
-
Save ewalk153/fafe1fc04b15449db1fd to your computer and use it in GitHub Desktop.
example to serialize an attribute in 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 FavOptions < Array | |
| def self.dump(ingredients) | |
| ingredients ? ingredients.join(";") : nil | |
| end | |
| def self.load(ingredients) | |
| ingredients ? new(ingredients.split(";")) : nil | |
| end | |
| end | |
| serialize :options, FavOptions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment