Trouble with link_to_remote

Does anybody have any guesses about why this is happening? Specifically, why it is trying to call the id as an action in the second attempt:

### Attempt One

<%= link_to_remote(image_tag('button_details.gif', :id => "details"), :update => "results", :url => {:controller => "masters", :action => "show"}) %>

### Attempt One Console

Parameters: {"action"=>"show", "controller"=>"masters"} ActiveRecord::RecordNotFound (Couldn't find Master without an ID)

OK, this makes sense. I just need to pass along an ID...

### Attempt Two

<%= link_to_remote(image_tag('button_details.gif', :id => "details"), :update => "results", :url => {:controller => "masters", :action => "show", :id => contact.id}) %>

### Attempt Two Console

Parameters: {"action"=>"4", "controller"=>"masters"} ActionController::UnknownAction (No action responded to 4):

### Controller

  def show

    user = User.find(current_user.id)     @master = user.masters.find(params[:id])

    respond_to do |format|       format.html # show.html.erb       format.xml { render :xml => @master }     end   end

<%= link_to_remote(image_tag('button_details.gif', :id => "details"), :update => "results", :url => {:controller => "masters", :action => "show", :id => contact.id}) %>

Your image_tag javascript generator is messing up your link_to_remote javascript helper.

My guess is that you want to perform a link to remote when the image is clicked.. In which case, I think you should just use an image tag with a javascript onClick() handler instead of the javascript generators

hth

ilan

Ilan,

Thanks for the tip. I went ahead and stripped out the image tag and replaced it just with the standard text link...

<%= link_to_remote "Details", :id => "details"), :update => "results", :url => {:controller => "masters", :action => "show", :id => contact.id} %>

but it's still having the same complication.

:frowning:

Ilan Berci wrote: