to_xml
Posted by Adam Wiggins on March 16, 2008 at 07:57 PM
When serving up an ActiveRecord as resource, you can use options like :only and :except to to_xml. But in most cases, you want the same fields served every time - on create, update, and get. So put the options into the class itself:
def to_xml(options={}) options[:only] ||= [ :name, :width, :height, :created_at ] super end
Comments
There are 0 comments on this post. Post yours →
Post a comment
Required fields in bold.