Created
March 6, 2011 08:48
-
-
Save burtlo/857148 to your computer and use it in GitHub Desktop.
Utilizing modules to reduce element declarations
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
require 'happymapper' | |
module Publication | |
def self.included(receiver) | |
receiver.element :featured, Boolean, :tag => 'isFeatured' | |
receiver.element :exclusive, Boolean, :tag => 'isExclusive' | |
receiver.element :sponsored, Boolean, :tag => 'isSponsored' | |
end | |
end | |
class Article | |
include HappyMapper | |
has_one :title, String | |
include Publication | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment