Rails 2.1.1
Among other things, a security fix.
This commit is contained in:
parent
d2c4c8737c
commit
d4f97345db
354 changed files with 21027 additions and 3072 deletions
|
@ -30,7 +30,7 @@ module ActiveResource
|
|||
# Person.get(:active) # GET /people/active.xml
|
||||
# # => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]
|
||||
#
|
||||
module CustomMethods
|
||||
module CustomMethods
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
extend ActiveResource::CustomMethods::ClassMethods
|
||||
|
@ -83,24 +83,25 @@ module ActiveResource
|
|||
"#{prefix(prefix_options)}#{collection_name}/#{method_name}.#{format.extension}#{query_string(query_options)}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module InstanceMethods
|
||||
def get(method_name, options = {})
|
||||
connection.get(custom_method_element_url(method_name, options), self.class.headers)
|
||||
end
|
||||
|
||||
def post(method_name, options = {}, body = '')
|
||||
|
||||
def post(method_name, options = {}, body = nil)
|
||||
request_body = body.nil? ? encode : body
|
||||
if new?
|
||||
connection.post(custom_method_new_element_url(method_name, options), (body.nil? ? to_xml : body), self.class.headers)
|
||||
connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
|
||||
else
|
||||
connection.post(custom_method_element_url(method_name, options), body, self.class.headers)
|
||||
connection.post(custom_method_element_url(method_name, options), request_body, self.class.headers)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def put(method_name, options = {}, body = '')
|
||||
connection.put(custom_method_element_url(method_name, options), body, self.class.headers)
|
||||
end
|
||||
|
||||
|
||||
def delete(method_name, options = {})
|
||||
connection.delete(custom_method_element_url(method_name, options), self.class.headers)
|
||||
end
|
||||
|
@ -110,7 +111,7 @@ module ActiveResource
|
|||
def custom_method_element_url(method_name, options = {})
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
|
||||
end
|
||||
|
||||
|
||||
def custom_method_new_element_url(method_name, options = {})
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue