# I am trying to use AJAX action is performed but then get missing template message.

**URL:** <https://discuss.rubyonrails.org/t/i-am-trying-to-use-ajax-action-is-performed-but-then-get-missing-template-message/12910>\
**Category:** rubyonrails-talk\
**Created:** [May 14, 2007, 2:34am UTC](https://discuss.rubyonrails.org/t/i-am-trying-to-use-ajax-action-is-performed-but-then-get-missing-template-message/12910 "2007-05-14T02:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Jonathan\_Thomps](https://avatars.discourse-cdn.com/v4/letter/p/a587f6/32.png) [@Paul\_Jonathan\_Thomps](https://discuss.rubyonrails.org/u/Paul_Jonathan_Thomps)\
**Post date:** [May 14, 2007, 2:34am UTC](https://discuss.rubyonrails.org/t/i-am-trying-to-use-ajax-action-is-performed-but-then-get-missing-template-message/12910/1 "2007-05-14T02:34:45Z")

</div>

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 &nbsp;&nbsp;@consultant = session[:consultant] &nbsp;&nbsp;@clients = Client.list\_clients(@consultant) &nbsp;&nbsp;render :layout =\>'admin\_client', :action =\> 'accept\_list' &nbsp;&nbsp;end

&nbsp;&nbsp;def accepted &nbsp;&nbsp;&nbsp;&nbsp;begin &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@client = Client.find(params[:id]) &nbsp;&nbsp;&nbsp;&nbsp;rescue ActiveRecord::RecordNotFound &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.error("Attempt to access an invalid product #{parems[:id]}") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redirect\_to :action =\> :accept\_list &nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@client.date\_accepted = Date.today &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@client.update\_attributes(params[:client]) &nbsp;&nbsp;&nbsp;&nbsp;end end

This is my view "accept\_list"

\<% for client in @clients -%\>

\<div class="main"\>

&nbsp;&nbsp;\<table width="90%" boader="0" cellspacing="0" cellpadding="1"\> &nbsp;&nbsp;&nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<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(client.id) %\>\</h4\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= h(client.addr1) %\>\</td\>\<td\>\<label for="w\_ph"

> Work:\</label\>\</td\>\<td\>\<%= h(client.w\_ph) %\>\</td\>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<div id="accepted"\>\<label for="date\_accepted" \>Date accepted:\</label\>\</td\>\<td\>\<h4\>\<%= h(client.date\_accepted) %\>\</h4\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= link\_to\_remote( "Accept", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:update =\> "accepted", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:url =\>{ :action =\> :accepted, :id =\> client }) %\>\</div\>\</td\> \<!-- \<td\>\<%= button\_to 'Accept', :controller =\> 'admin\_client', :action =\> 'accepted', :id =\> client %\>\</td\> --\> &nbsp;&nbsp;&nbsp;&nbsp;\</tr\> &nbsp;&nbsp;&nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= h(client.suburb) %\>\</td\>\<td\>\<label for="h\_ph"

> Home:\</label\>\</td\>\<td\>\<%= h(client.h\_ph) %\>\</td\>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<label for="date\_follow\_up" \>Date follow up:\</label\>\</td\>\<td\>\<%= h(client.date\_follow\_up) %\>\</td\> &nbsp;&nbsp;&nbsp;&nbsp;\</tr\> &nbsp;&nbsp;&nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= h(client.city) %\>\</td\>\<td\>\<label for="mobile"

> Mobile:\</label\>\</td\>\<td\>\<%= h(client.mobile) %\>\</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\> &nbsp;&nbsp;&nbsp;&nbsp;\</tr\> &nbsp;&nbsp;&nbsp;&nbsp;\<tr\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%= mail\_to(client.email, h(client.email), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:subject =\> "Your Quote", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: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) %\>\</h4\>\</td\>\<td\>\</td\>\</tr\> &nbsp;&nbsp;\</table\>

\</div\>

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

advice will be most appreciated.

Regards,

Paul

---

<div class="post-metadata">

**Author:** ![Bill\_Walton](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@Bill\_Walton](https://discuss.rubyonrails.org/u/Bill_Walton)\
**Post date:** [May 14, 2007, 12:43pm UTC](https://discuss.rubyonrails.org/t/i-am-trying-to-use-ajax-action-is-performed-but-then-get-missing-template-message/12910/2 "2007-05-14T12:43:13Z")

</div>

Hi Paul,

Paul Jonathan Thompson wrote:

> 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 accepted begin &nbsp;&nbsp;&nbsp;@client = Client.find(params[:id]) rescue ActiveRecord::RecordNotFound &nbsp;&nbsp;&nbsp;logger.error("Attempt to access an invalid product #{parems[:id]}") &nbsp;&nbsp;&nbsp;redirect\_to :action =\> :accept\_list else &nbsp;&nbsp;&nbsp;@client.date\_accepted = Date.today &nbsp;&nbsp;&nbsp;@client.update\_attributes(params[:client])

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render :nothing =\> 'true'

> &nbsp;&nbsp;&nbsp;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
