Passing several instant variables to a rjs file

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?

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 }

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs