From 9dc9db1c99bce6b4c478f0a587abcb7744f2ad5e Mon Sep 17 00:00:00 2001 From: Robert Ross Date: Mon, 21 Nov 2011 17:06:00 -0800 Subject: Fix missing single quote that was messing up syntax highlighting. --- activeresource/lib/active_resource/custom_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activeresource/lib/active_resource/custom_methods.rb') diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb index c1931b2758..f7cb381711 100644 --- a/activeresource/lib/active_resource/custom_methods.rb +++ b/activeresource/lib/active_resource/custom_methods.rb @@ -23,7 +23,7 @@ module ActiveResource # self.site = "http://37s.sunrise.i:3000" # end # - # Person.new(:name => 'Ryan).post(:register) # POST /people/new/register.json + # Person.new(:name => 'Ryan').post(:register) # POST /people/new/register.json # # => { :id => 1, :name => 'Ryan' } # # Person.find(1).put(:promote, :position => 'Manager') # PUT /people/1/promote.json -- cgit v1.2.3 From 93387e2e7c66fb34bde5442ad314c9c63729b75b Mon Sep 17 00:00:00 2001 From: lest Date: Wed, 30 Nov 2011 18:44:37 +0300 Subject: fix deprecation warnings in activeresource --- .../lib/active_resource/custom_methods.rb | 48 +++++++++++----------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'activeresource/lib/active_resource/custom_methods.rb') diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb index f7cb381711..2a651dd48e 100644 --- a/activeresource/lib/active_resource/custom_methods.rb +++ b/activeresource/lib/active_resource/custom_methods.rb @@ -85,37 +85,35 @@ module ActiveResource end end - module InstanceMethods - def get(method_name, options = {}) - self.class.format.decode(connection.get(custom_method_element_url(method_name, options), self.class.headers).body) - end + def get(method_name, options = {}) + self.class.format.decode(connection.get(custom_method_element_url(method_name, options), self.class.headers).body) + end - def post(method_name, options = {}, body = nil) - request_body = body.blank? ? encode : body - if new? - 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), request_body, self.class.headers) - end + def post(method_name, options = {}, body = nil) + request_body = body.blank? ? encode : body + if new? + 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), 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 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 + def delete(method_name, options = {}) + connection.delete(custom_method_element_url(method_name, options), self.class.headers) + end - private - 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 + private + 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 - 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 end end -- cgit v1.2.3