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
- Host: GitHub
- URL: https://github.com/bumi/serializefu
- Owner: bumi
- License: mit
- Created: 2008-07-26T23:12:33.000Z (almost 18 years ago)
- Default Branch: master
- Last Pushed: 2008-07-26T23:14:42.000Z (almost 18 years ago)
- Last Synced: 2025-01-01T18:31:30.594Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 78.1 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
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