static public Method

CustomMethods.get(custom_method_name, options = {})

Invokes a GET to a given custom REST method. For example:

Person.get(:active)  # GET /people/active.xml
# => [{:id => 1, :name => 'Ryan'}, {:id => 2, :name => 'Joe'}]

Person.get(:active, :awesome => true)  # GET /people/active.xml?awesome=true
# => [{:id => 1, :name => 'Ryan'}]

Note: the objects returned from this method are not automatically converted into ActiveResource instances - they are ordinary Hashes. If you are expecting ActiveResource instances, use the find class method with the :from option. For example:

Person.find(:all, :from => :active)

Source Code

# File active_resource/custom_methods.rb, line 56
def get(custom_method_name, options = {})
  connection.get(custom_method_collection_url(custom_method_name, options), headers)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.