Thanks Michael.
I've taken the easy (and hacky) way out by using an
ActiveRecord::Errors object which is transformed implements to_xml
quite nicely.
The hacky bit is that I'm not always adding an error that coincides
with an attribute of the model I'm exploiting .. eg,
errors.add( :code, "#{code} is not found" )
..when my model object doesn't actually have a "code" attribute.
Also... under some scenarios I may not have a model instance at all
but need to create one in order to gain access to the to_xml friendly
Errors object by doing something like...
errors = Player.new.errors
... which is of course hacky, but more readily thrown together than
implementing a custom errors class or modifying the conversions.rb
The Errors object is also nice because it allows multiple errors with
the same key...
errors.add( :code, "#{code} is not found" )
errors.add( :code, "#{code} has already been processed" )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---