Very useful rails array helper method I learned about today: in_groups_of. very cool.

Returns a string that represents the array in XML by invoking to_xml on each element. Active Record collections delegate their representation in XML to this method. All elements are expected to respond to to_xml , if any of them does not then an exception is raised. The root node reflects the class name of the first element in plural if all elements belong to the same type and that’s not Hash: customer.projects.to_xml <?xml version="1.0" encoding="UTF-8"?> <projects type="array"> <project> <amount type="decimal">20000.0</amount> <customer-id type="integer">1567</customer-id> <deal-date type="date">2008-04-09</deal-date> ... </project> <project> <amount type="decimal">57230.0</amount> <customer-id type="integer">1567</customer-id> <deal-date type="date">2008-04-15</deal-date> ... </project> </projects> Otherwise the root element is “objects”: [{ foo: 1, bar: 2}, { baz: 3}]....