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
|
||||
|
|
|
@ -57,7 +57,7 @@ module ActiveResource
|
|||
# def post(path, request_headers = {}, body = nil, status = 200, response_headers = {})
|
||||
# @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || "", status, response_headers)
|
||||
# end
|
||||
module_eval <<-EOE, __FILE__, __LINE__
|
||||
module_eval <<-EOE, __FILE__, __LINE__ + 1
|
||||
def #{method}(path, request_headers = {}, body = nil, status = 200, response_headers = {})
|
||||
@responses << [Request.new(:#{method}, path, nil, request_headers), Response.new(body || "", status, response_headers)]
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ module ActiveResource
|
|||
# self.class.requests << request
|
||||
# self.class.responses.assoc(request).try(:second) || raise(InvalidRequestError.new("No response recorded for #{request}"))
|
||||
# end
|
||||
module_eval <<-EOE, __FILE__, __LINE__
|
||||
module_eval <<-EOE, __FILE__, __LINE__ + 1
|
||||
def #{method}(path, #{'body, ' if has_body}headers)
|
||||
request = ActiveResource::Request.new(:#{method}, path, #{has_body ? 'body, ' : 'nil, '}headers)
|
||||
self.class.requests << request
|
||||
|
|
|
@ -259,10 +259,10 @@ module ActiveResource
|
|||
save_without_validation
|
||||
true
|
||||
rescue ResourceInvalid => error
|
||||
case error.response['Content-Type']
|
||||
when /xml/
|
||||
case self.class.format
|
||||
when ActiveResource::Formats[:xml]
|
||||
errors.from_xml(error.response.body)
|
||||
when /json/
|
||||
when ActiveResource::Formats[:json]
|
||||
errors.from_json(error.response.body)
|
||||
end
|
||||
false
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveResource
|
|||
module VERSION #:nodoc:
|
||||
MAJOR = 2
|
||||
MINOR = 3
|
||||
TINY = 5
|
||||
TINY = 8
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue