Flowdock
method

included

Importance_0
v2.0.0 - Show latest stable - 0 notes - Class: ActiveResource::CustomMethods
included(within) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activeresource/lib/active_resource/custom_methods.rb, line 34
    def self.included(within)
      within.class_eval do
        extend ActiveResource::CustomMethods::ClassMethods
        include ActiveResource::CustomMethods::InstanceMethods

        class << self
          alias :orig_delete :delete

          def get(method_name, options = {})
            connection.get(custom_method_collection_url(method_name, options), headers)
          end

          def post(method_name, options = {}, body = '')
            connection.post(custom_method_collection_url(method_name, options), body, headers)
          end

          def put(method_name, options = {}, body = '')
            connection.put(custom_method_collection_url(method_name, options), body, headers)
          end

          # Need to jump through some hoops to retain the original class 'delete' method
          def delete(custom_method_name, options = {})
            if (custom_method_name.is_a?(Symbol))
              connection.delete(custom_method_collection_url(custom_method_name, options), headers)
            else
              orig_delete(custom_method_name, options)
            end
          end
        end
      end
    end
Register or log in to add new notes.