# Passing several instant variables to a rjs file

**URL:** <https://www.ruby-forum.com/t/passing-several-instant-variables-to-a-rjs-file/105177>\
**Category:** Rails\
**Created:** [May 26, 2007, 6:50pm UTC](https://www.ruby-forum.com/t/passing-several-instant-variables-to-a-rjs-file/105177 "2007-05-26T18:50:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jochen\_kaechelin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@jochen\_kaechelin](https://www.ruby-forum.com/u/jochen_kaechelin)\
**Post date:** [May 26, 2007, 6:50pm UTC](https://www.ruby-forum.com/t/passing-several-instant-variables-to-a-rjs-file/105177/1 "2007-05-26T18:50:23Z")

</div>

I have controller:

def liste  
@tags\_pages, @tags = paginate(:tags, :order =\> “tags desc”)  
end

and a RJS-file (liste.rjs):

page[:main].replace\_html :partial =\> “liste”, :object =\> @tags ???

and a RHTML-file (\_liste.rhtml):

\<% for a in @tags %\>  
\<%= a.tag.downcase %\>  
\<% end %\>

I want to display a page with all tags in the database. Because  
there are a hundred of them I want’ to use pagination. But to use  
the RJS file I need @tags\_pages AND @tags in it.

How to manage this?

---

<div class="post-metadata">

**Author:** ![jochen\_kaechelin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/48db29/32.png) [@jochen\_kaechelin](https://www.ruby-forum.com/u/jochen_kaechelin)\
**Post date:** [May 27, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/passing-several-instant-variables-to-a-rjs-file/105177/2 "2007-05-27T13:24:00Z")

</div>

Didn’t try it yet, but from what the API docs of ActionView and  
ActionController say about the render command, you should be able to  
just pass a hash:

from API:  
You can pass local variables to sub templates by using a hash with the  
variable names as keys and the objects as values:

\<%= render “shared/header”, { :headline =\> “Welcome”, :person =\>  
person } %\>

so try this:

page[:main].replace\_html :partial =\> “liste”, {:tags =\>  
@tags, :tag\_pages =\> @tag\_pages }
