views:

80

answers:

1

Hi there, I'm trying to request data from another Rails app, but I keep getting a "URL not found" error. Is it possible to use the debugger to figure out the intended URL and parameters for an intended ActiveResource call?

For example, I'd like to make a GET request with the following parameters:

https://some_server.com/employees/search.xml?last_name=smith

And I have the following ActiveResource model

class Employee < ActiveResource::Base
  self.site = "https://some_server.com"
end

And the some_server.com app has a search action that maps this way:

map.connect "/employees/search.:format", :controller => 'employees', :action => 'search'

But when I try this:

Employee.new(:last_name => 'smith).get(:search)

I get a 404 "Service not found" error. To me, that sounds like the URL that ACtiveResource is requesting is incorrect, 'cause when I make the above request via a browser, I get the xml. Any idea what I'm doing wrong?

Cheerio, Berns

A: 

Figured it out:

I'm supposed to be calling this:

Employee.get(:search, :last_name => 'smith')

NOT what I showed above.

btelles