Update to Rails 2.3.8
This commit is contained in:
parent
6677b46cb4
commit
f0635301aa
429 changed files with 17683 additions and 4047 deletions
|
@ -227,6 +227,9 @@ module ActiveResource
|
|||
# The logger for diagnosing and tracing Active Resource calls.
|
||||
cattr_accessor :logger
|
||||
|
||||
# Controls the top-level behavior of JSON serialization
|
||||
cattr_accessor :include_root_in_json, :instance_writer => false
|
||||
|
||||
class << self
|
||||
# Gets the URI of the REST resources to map for this class. The site variable is required for
|
||||
# Active Resource's mapping to work.
|
||||
|
@ -431,11 +434,11 @@ module ActiveResource
|
|||
@prefix_parameters = nil
|
||||
|
||||
# Redefine the new methods.
|
||||
code = <<-end_code
|
||||
code, line = <<-end_code, __LINE__ + 1
|
||||
def prefix_source() "#{value}" end
|
||||
def prefix(options={}) "#{prefix_call}" end
|
||||
end_code
|
||||
silence_warnings { instance_eval code, __FILE__, __LINE__ }
|
||||
silence_warnings { instance_eval code, __FILE__, line }
|
||||
rescue
|
||||
logger.error "Couldn't set prefix: #{$!}\n #{code}"
|
||||
raise
|
||||
|
@ -971,6 +974,12 @@ module ActiveResource
|
|||
case self.class.format
|
||||
when ActiveResource::Formats[:xml]
|
||||
self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options))
|
||||
when ActiveResource::Formats::JsonFormat
|
||||
if ActiveResource::Base.include_root_in_json
|
||||
self.class.format.encode({self.class.element_name => attributes}, options)
|
||||
else
|
||||
self.class.format.encode(attributes, options)
|
||||
end
|
||||
else
|
||||
self.class.format.encode(attributes, options)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue