# Rjs variable substitution problem

**URL:** <https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252>\
**Category:** Rails\
**Created:** [May 28, 2007, 4:56am UTC](https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252 "2007-05-28T04:56:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [May 28, 2007, 4:56am UTC](https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252/1 "2007-05-28T04:56:25Z")

</div>

I keep getting javascript alerts messages basically telling me that it  
can’t find the element. It obviously has something to do with the  
group.id value not being put in it’s place properly.

here is the action method

`def list_all
  @group = TaskGroup.find(params[:id])
end
`

Here is the rjs script

`page.hide 'task_group-#{group.id}'
page.replace_html 'task_group-#{group.id}', :partial => "tasks/
task", :collection => @group.tasks
page.visual_effect :blind_down, 'task_group-#{group.id}'
`

I have tried with and without the @, and am somewhat confused when to  
use the #{} vs the \<%= %\>, I am assuming rls files always use the #{}  
since most of the examples that I have seen use it that way.

Thanks for the help

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [May 28, 2007, 5:29am UTC](https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252/2 "2007-05-28T05:29:27Z")

</div>

use “” instead of ‘’

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [May 28, 2007, 6:48am UTC](https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252/3 "2007-05-28T06:48:30Z")

</div>

I have changed things around so that, that particular rjs file is not  
used anymore, but I will remember your tip for next time around. I  
didn’t think that ror was sensitive about quote types.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [May 29, 2007, 6:35am UTC](https://www.ruby-forum.com/t/rjs-variable-substitution-problem/105252/4 "2007-05-29T06:35:47Z")

</div>

On 5/28/07, chris [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have changed things around so that, that particular rjs file is not  
> used anymore, but I will remember your tip for next time around. I  
> didn’t think that ror was sensitive about quote types.

Of course sensitive. “” will do replacement when needed, while ‘’ will  
not.

Thanks for your help.
