Created
October 27, 2011 14:44
-
-
Save HeroicEric/1319737 to your computer and use it in GitHub Desktop.
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 Product | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :title, String, :required => true | |
| property :description, Text, :required => true | |
| has n, :variants | |
| after :create, :make_master_variant | |
| def make_master_variant | |
| self.variants.create(:sku => "cf-19") | |
| end | |
| def html_description | |
| Redcarpet.new(description).to_html | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment