Forum: Ruby on Rails I am trying to use AJAX action is performed but then get mis

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F8451aa0650d328c31023a2d46117cfb?d=identicon&s=25 Paul Jonathan Thompson (Guest)
on 2007-05-14 04:35
(Received via mailing list)

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

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'

  def accepted
      @client = Client.find(params[:id])
    rescue ActiveRecord::RecordNotFound
      logger.error("Attempt to access an invalid product
      redirect_to :action => :accept_list
       @client.date_accepted =

This is my view "accept_list"

<% for client in @clients -%>

<div class="main">

  <table width="90%" boader="0" cellspacing="0" cellpadding="1">
      <td colspan="3" align="left"><h3><%= h(client.primary_whole_name)
%></h3></td><td><h4><label for="id" >Quote
No.:</label></h4></td><td><h4><%= h( %></h4></td>
        <td><%= h(client.addr1) %></td><td><label for="w_ph"
>Work:</label></td><td><%= h(client.w_ph) %></td>
        <td><div id="accepted"><label for="date_accepted" >Date
accepted:</label></td><td><h4><%= h(client.date_accepted) %></h4></td>
        <td><%= link_to_remote( "Accept",
                         :update => "accepted",
                         :url =>{ :action => :accepted, :id => client
}) %></div></td>
<!--         <td><%= button_to 'Accept', :controller => 'admin_client',
:action => 'accepted', :id => client %></td> -->
        <td><%= h(client.suburb) %></td><td><label for="h_ph"
>Home:</label></td><td><%= h(client.h_ph) %></td>
        <td><label for="date_follow_up" >Date follow
up:</label></td><td><%= h(client.date_follow_up) %></td>
        <td><%= h( %></td><td><label for="mobile"
>Mobile:</label></td><td><%= h( %></td><td><label
for="date_entered" >Date captured:</label></td><td><%=
h(client.date_entered) %></td><td><%= link_to 'Show', :controller =>
'quote', :action => 'show_consultant', :id => client %></td>
        <td><%= mail_to(, h(,
                            :subject => "Your Quote",
                            :encode  => "javascript")
%></td><td><label for="fax" >Fax:</label></td><td><%= h(client.fax)
%></td><td><label for="tot_value" >Total value of Quote (ex. gst)
:</label></td><td align="left"><h4><%= format_price(client.tot_value)


<div class="separator">&nbsp;</div>
<% end %>

advice will be most appreciated.


Dd69c1cde04fed6dac9970feef83220b?d=identicon&s=25 Keshav (Guest)
on 2007-05-14 06:40

You may have to use "render_text" as shown in this article, otherwise
the system expects to have accepted.rhtml in the view directory to spit
the output of the action "accepted".

Hope this helps.

2b891e820c238ded365d035771603f21?d=identicon&s=25 Bill Walton (Guest)
on 2007-05-14 14:44
(Received via mailing list)
Hi Paul,

Paul Jonathan Thompson wrote:

>    logger.error("Attempt to access an invalid product #{parems[:id]}")
>    redirect_to :action => :accept_list
>  else
>    @client.date_accepted =
>    @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
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
use RJS, even if there's only one element to update and I could use

This topic is locked and can not be replied to.