# RJS - ActionView::TemplateError (page)

**URL:** <https://discuss.rubyonrails.org/t/rjs-actionview-templateerror-page/51537>\
**Category:** rubyonrails-talk\
**Created:** [May 10, 2010, 7:48pm UTC](https://discuss.rubyonrails.org/t/rjs-actionview-templateerror-page/51537 "2010-05-10T19:48:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [May 10, 2010, 7:48pm UTC](https://discuss.rubyonrails.org/t/rjs-actionview-templateerror-page/51537/1 "2010-05-10T19:48:54Z")

</div>

Without going into too much detail, is there something obvious that I'm missing here? It seems to be finding the RJS file as expected but generates this error:

ActionView::TemplateError (undefined local variable or method `page' for #\<ActionView::Base:0x7f202a04\>) on line #1 of app/views/fuelings/index.js.rjs: 1: page.toggle 'fuelings'

&nbsp;&nbsp;&nbsp;&nbsp;app/views/fuelings/index.js.rjs:1:in `_run_rjs_app47views47fuelings47index46js46rjs' &nbsp;&nbsp;&nbsp;&nbsp;app/views/fuelings/index.js.rjs:1:in `\_run\_rjs\_app47views47fuelings47index46js46rjs' &nbsp;&nbsp;&nbsp;&nbsp;app/controllers/fuelings\_controller.rb:6:in `index'

The general outline (without posting too much code) is: 1) Index action in the controller has a respond\_to that invokes index.js.rjs 2) The index view has an observe that triggers when the select changes 3) The RJS renders a partial (not implemented yet)

Also set up a skeleton rails app just to test RJS and am getting the same thing when I try any RJS tests.

---

<div class="post-metadata">

**Author:** ![Bill\_Walton1](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Bill\_Walton1](https://discuss.rubyonrails.org/u/Bill_Walton1)\
**Post date:** [May 10, 2010, 11:56pm UTC](https://discuss.rubyonrails.org/t/rjs-actionview-templateerror-page/51537/2 "2010-05-10T23:56:07Z")

</div>

Hi Kurt,

> Without going into too much detail, is there something obvious that I’m
> 
> missing here?

The only thing that jumps out at me is the lack of a block after your format…

Try adding it: format.js {}

If that doesn’t work, add try getting rid of the rjs template for now and just render from the contoller. Generally speaking, that’s preferable for a one-liner anyway.

format.js { render :update do |page| page.toggle ‘fuelings’ end }

HTH, Bill
