This project is archived and is in readonly mode.
ActiveRecord::Serialization class method from_xml handles arrays and singleton XML instances
-
sbwoodside
module ActiveRecord::Serialization def self.from_xml(xml) the_class = Hash.from_xml(xml).keys.first.singularize.camelize.constantize # singularize does nothing if already singular array_or_hash = Hash.from_xml(xml).values.first array_or_hash.class == Array ? array_or_hash.map { |hash| the_class.new( hash ) } : the_class.new( array_or_hash ) end end -
Rohit Arondekar
- State changed from new to stale
- Importance changed from to
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.