Button_to_remote problem "index 115225 out of string"

hey all

I have some nested resource ‘sku_price_bands’ which are nested inside
‘skus’ which are nested inside ‘music_services’:

in routes.rb:

map.resources :music_service do |music_service|
music_service.resources :skus do |sku|
sku.resources :sku_price_bands
end
end

Now, i’m trying to use some button_to_remote form helpers and getting an
error like

“index 115225 out of string”

Here’s an example of an exploding helper:

<%= button_to_remote “Delete this sku”,
music_service_sku_path(@music_service, sku), :method => :delete %>

I have a skus_controller (the usual restful controller), with an update
action which expects to get :music_service_id, and i have the
appropriate route set up, i can see it in rake routes:

music_service_sku GET /music_service/:music_service_id/skus/:id
{:action=>“show”, :controller=>“skus”}
PUT /music_service/:music_service_id/skus/:id
{:action=>“update”, :controller=>“skus”}
DELETE /music_service/:music_service_id/skus/:id
{:action=>“destroy”, :controller=>“skus”}

There’s nothing funny going on with @music_service and sku - they are
both defined and point to some appropriate instances - i can see this by
inspecting them on the page and logging the results. They all have the
default to_param method from AR:Base.

It’s always the same ‘11525’ number that shows up in the exception.

I’m out of ideas - can anyone help?
max

Max W. wrote:

<%= button_to_remote “Delete this sku”,
music_service_sku_path(@music_service, sku), :method => :delete %>

Never mind - the problem was that i had to pass the path as the :url
option, ie

<%= button_to_remote “Delete this sku”,
:url => music_service_sku_path(@music_service, sku),
:method => :delete %>

doh. I get mixed up with this stuff because with link_to you just pass
the path (like in my original example) but in link_to_remote you have to
put it in the :url option.

Anyway, thanks for reading :slight_smile: