Rus
2007-Sep-25 17:39 UTC
Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Added one-off declarations of mock behavior [DHH]
Nice work. I actually did similar work recently, but hadn''t had the cycles to contribute it back. I''ll be sure to provide some feed back though. Cheers, Rus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
DHH
2007-Sep-25 18:47 UTC
Re: Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Added one-off declarations of mock behavior [DHH]
Thanks. It could be great if people could put this stuff through the ringer. I haven''t had a chance to do a real thorough testing of it yet in the wild. On Sep 25, 12:39 pm, Rus <rbpan...@gmail.com> wrote:> Nice work. I actually did similar work recently, but hadn''t had the > cycles to contribute it back. I''ll be sure to provide some feed back > though. > > Cheers, > Rus--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Rus
2007-Sep-25 20:38 UTC
Re: Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Added one-off declarations of mock behavior [DHH]
I see that deserialization of error response bodies in validation.rb hasn''t been refactored yet to use the new format serialization abstraction, ie. (below). Should I add something to Trac about this? # Grabs errors from the XML response. def from_xml(xml) clear humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) } messages = Hash.from_xml(xml)[''errors''][''error''] rescue [] messages.each do |message| attr_message = humanized_attributes.keys.detect do |attr_name| if message[0, attr_name.size + 1] == "#{attr_name} " add humanized_attributes[attr_name], message[(attr_name.size + 1)..-1] end end add_to_base message if attr_message.nil? end end On Sep 25, 2:47 pm, DHH <david.heineme...@gmail.com> wrote:> Thanks. It could be great if people could put this stuff through the > ringer. I haven''t had a chance to do a real thorough testing of it yet > in the wild. > > On Sep 25, 12:39 pm, Rus <rbpan...@gmail.com> wrote: > > > Nice work. I actually did similar work recently, but hadn''t had the > > cycles to contribute it back. I''ll be sure to provide some feed back > > though. > > > Cheers, > > Rus--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Rus
2007-Sep-25 20:40 UTC
Re: Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Added one-off declarations of mock behavior [DHH]
I added a couple of issues to Trac (9681, 9683, 9684). 83 and 84 are relevant to your format work. On Sep 25, 4:38 pm, Rus <rbpan...@gmail.com> wrote:> I see that deserialization of error response bodies in validation.rb > hasn''t been refactored yet to use the new format serialization > abstraction, ie. (below). Should I add something to Trac about this? > > # Grabs errors from the XML response. > def from_xml(xml) > clear > humanized_attributes = @base.attributes.keys.inject({}) { |h, > attr_name| h.update(attr_name.humanize => attr_name) } > messages = Hash.from_xml(xml)[''errors''][''error''] rescue [] > messages.each do |message| > attr_message = humanized_attributes.keys.detect do |attr_name| > if message[0, attr_name.size + 1] == "#{attr_name} " > add humanized_attributes[attr_name], > message[(attr_name.size + 1)..-1] > end > end > > add_to_base message if attr_message.nil? > end > end > > On Sep 25, 2:47 pm, DHH <david.heineme...@gmail.com> wrote: > > > Thanks. It could be great if people could put this stuff through the > > ringer. I haven''t had a chance to do a real thorough testing of it yet > > in the wild. > > > On Sep 25, 12:39 pm, Rus <rbpan...@gmail.com> wrote: > > > > Nice work. I actually did similar work recently, but hadn''t had the > > > cycles to contribute it back. I''ll be sure to provide some feed back > > > though. > > > > Cheers, > > > Rus--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---