Created
March 25, 2010 12:53
-
-
Save speedmax/343520 to your computer and use it in GitHub Desktop.
MongoMapper ActiveModel serialization compatible
This file contains 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
module ActiveModel::Compatible | |
extend ActiveSupport::Concern | |
extend ActiveModel::Naming | |
include ActiveModel::Serializers::Xml | |
include ActiveModel::Serializers::JSON | |
def to_xml(options = {}, &block) | |
options[:except] ||= [] | |
options[:except] << :_id | |
super options do |b| | |
b.id self.id | |
block.call(b) if block_given? | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment