diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-30 08:07:51 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-30 08:07:51 -0800 |
commit | 3b07bb33e155006071b62cec53481af197df7ad9 (patch) | |
tree | 3168f09ecd36514889690db5b30ca989cb53d579 /activeresource/lib/active_resource/custom_methods.rb | |
parent | 2b96b20f3a8deff61d9a8dd5866cae5251ea5e1c (diff) | |
parent | 6ce924fa9f8ab2d96d8d78461d9a88aa0e99ec7b (diff) | |
download | rails-3b07bb33e155006071b62cec53481af197df7ad9.tar.gz rails-3b07bb33e155006071b62cec53481af197df7ad9.tar.bz2 rails-3b07bb33e155006071b62cec53481af197df7ad9.zip |
Merge pull request #3810 from lest/fix-warnings
fix method redefined warnings in tests
Diffstat (limited to 'activeresource/lib/active_resource/custom_methods.rb')
-rw-r--r-- | activeresource/lib/active_resource/custom_methods.rb | 48 |
1 files changed, 23 insertions, 25 deletions
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 |