Agile Web Development

Build it. Launch it. Love it.

xml_protected

Keeps specified attributes of a model out of toxml. Do so by aliasing toxml, and automatically sending in the correct :excludes to the original to_xml method, e.g. :excludes => [:attr1, :attr2, ...]

h2. Usage

An ActiveRecord Model:

class Model < ActiveRecord::Base
  include XmlProtected # Required because it's a gemmefied plugin
  xml_protected :attr1, :attr2, :attr3
end

You can also access these attributes from the added class method: protectedxmlattributes

h3. In Conjunction with attr_protected

class Model < ActiveRecord::Base
  include XmlProtected # Required because it's a gemmefied plugin
  attr_protected :attr1, :attr2, :attr3
  xml_protected :attr1, :attr2, :attr3
end

Vitals

Home http://github.com/thrivesmart/xml_protected
Repository git://github.com/thrivesmart/xml_protected.git
License Rails' (MIT)
Tags Tag_red activerecord ActiveResource to_xml
Rating (3 votes)
Owner ThriveSmart, LLC
Created 1 October 2008

Comments

Add a comment