https://github.com/atomicobject/to_api
Instead of to_xml and as_json, simply implement to_api. Return an unformatted hash. Let the model understand the data. Let the controller understand the format. In Rails, the controller can simply call render :xml => model.to_api or render :json => model.to_api.
https://github.com/atomicobject/to_api
Last synced: 10 months ago
JSON representation
Instead of to_xml and as_json, simply implement to_api. Return an unformatted hash. Let the model understand the data. Let the controller understand the format. In Rails, the controller can simply call render :xml => model.to_api or render :json => model.to_api.
- Host: GitHub
- URL: https://github.com/atomicobject/to_api
- Owner: atomicobject
- Created: 2010-12-10T16:30:07.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2017-01-20T18:49:26.000Z (over 9 years ago)
- Last Synced: 2025-06-08T22:08:05.623Z (11 months ago)
- Language: Ruby
- Homepage:
- Size: 30.3 KB
- Stars: 15
- Watchers: 25
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md