Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/active_resource/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
Expand Down