I am trying to use AJAX action is performed but then get mis

Hi,

I am trying to update a field (date_accepted) in my view by clicking a
button and using AJAX link_to_remote. The field is being updated but
then the progam bombs with “Template is missing Missing template
script/…/config/…/app/views/admin_client/accepted.rhtml”

This is my code: Controler “admin_client”

def accept_list
@consultant = session[:consultant]
@clients = Client.list_clients(@consultant)
render :layout =>‘admin_client’, :action => ‘accept_list’
end

def accepted
begin
@client = Client.find(params[:id])
rescue ActiveRecord::RecordNotFound
logger.error(“Attempt to access an invalid product
#{parems[:id]}”)
redirect_to :action => :accept_list
else
@client.date_accepted = Date.today
@client.update_attributes(params[:client])
end
end

This is my view “accept_list”

<% for client in @clients -%>

<%= h(client.primary_whole_name) %>

Quote No.:

<%= h(client.id) %>

<%= h(client.addr1) %> Work: <%= h(client.w_ph) %>
Date accepted:

<%= h(client.date_accepted) %>

<%= link_to_remote( "Accept", :update => "accepted", :url =>{ :action => :accepted, :id => client }) %>
<%= h(client.suburb) %> Home: <%= h(client.h_ph) %> Date follow up: <%= h(client.date_follow_up) %>
<%= h(client.city) %> Mobile: <%= h(client.mobile) %> Date captured: <%= h(client.date_entered) %> <%= link_to 'Show', :controller => 'quote', :action => 'show_consultant', :id => client %>
<%= mail_to(client.email, h(client.email), :subject => "Your Quote", :encode => "javascript") %> Fax: <%= h(client.fax) %> Total value of Quote (ex. gst) :

<%= format_price(client.tot_value) %>

 
<% end %>

advice will be most appreciated.

Regards,

Paul

Hi,

You may have to use “render_text” as shown in this article
Radar – O’Reilly, otherwise
the system expects to have accepted.rhtml in the view directory to spit
the output of the action “accepted”.

Hope this helps.

Keshav

Hi Paul,

Paul Jonathan T. wrote:

logger.error(“Attempt to access an invalid product #{parems[:id]}”)
redirect_to :action => :accept_list
else
@client.date_accepted = Date.today
@client.update_attributes(params[:client])
render :nothing => ‘true’
end
end

I think you need to tell Rails what to render, as I did above. It seems
like maybe Rails should already know that you’re rendering via JS given
that
you’ve specified the :update clause, but I don’t think it’s quite that
smart. Personally, I’ve found that it’s easier to keep straight if I
just
use RJS, even if there’s only one element to update and I could use
:update
instead.

hth,
Bill