diff --git a/lib/active_resource/base.rb b/lib/active_resource/base.rb index a53b6befee..72aed655d0 100644 --- a/lib/active_resource/base.rb +++ b/lib/active_resource/base.rb @@ -105,10 +105,10 @@ module ActiveResource # To customize how attributes are encoded and decoded, declare a format and override # its +encode+ and +decode+ methods: # - # module CamelcaseJsonFormat - # extend ActiveResource::Formats[:json] + # class CamelcaseJsonFormat + # include ActiveResource::Formats[:json] # - # def self.encode(resource, options = nil) + # def encode(resource, options = nil) # hash = resource.as_json(options) # hash = hash.deep_transform_keys! { |key| key.camelcase(:lower) } # super(hash) @@ -120,7 +120,7 @@ module ActiveResource # end # end # - # Person.format = CamelcaseJsonFormat + # Person.format = CamelcaseJsonFormat.new # # person = Person.new(first_name: "First", last_name: "Last") # person.encode diff --git a/test/fixtures/address.rb b/test/fixtures/address.rb index 742a335600..67a5562b13 100644 --- a/test/fixtures/address.rb +++ b/test/fixtures/address.rb @@ -5,7 +5,7 @@ class AddressXMLFormatter include ActiveResource::Formats::XmlFormat def decode(xml) - data = ActiveResource::Formats::XmlFormat.decode(xml) + data = super # process address fields data.each do |address| address["city_state"] = "#{address['city']}, #{address['state']}"