An open API service indexing awesome lists of open source software.

https://github.com/bumi/serializefu

OLD DO NOT USE! - Adds to_json and to_xml methods to your ActiveRecord models
https://github.com/bumi/serializefu

Last synced: about 2 months ago
JSON representation

OLD DO NOT USE! - Adds to_json and to_xml methods to your ActiveRecord models

Awesome Lists containing this project

README

          

SerializeFu
===========

Adds to_json and to_xml methods to your ActiveRecord models

serialize_fu accepts the same options as the AR#to_xml method
serialize_fu just passes the options to to_xml and to_json

Example
=======

class Post < ActiveRecord::Base
serialize_fu :only => [:body], :include => :user
end

is the same as:

class Post < ActiveRecord::Base

def to_json(options={})
super { :only => [:body], :include => :user}.merge(options)
end

def to_xml(options={})
super { :only => [:body], :include => :user}.merge(options)
end
end

Copyright (c) 2008 [Michael Bumann michael@railslove.com], released under the MIT license