How do I verify the URL that ActiveResource intends to use on a call?

Posted by btelles on Stack Overflow See other posts from Stack Overflow or by btelles
Published on 2010-05-12T13:02:00Z Indexed on 2010/05/12 13:04 UTC
Read the original article Hit count: 284

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

© Stack Overflow or respective owner

Related posts about activeresource

Related posts about rubyonrails