Forum: Ruby on Rails Counting helpers through a view

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2005-12-21 07:47
I have a helper which will be placing certain tags through a view.
These tags have "Element.toggle" sorts of relations, so I need to have
different id's assigned to their HTML elements.

What I would like to do is somehow count them as they are installed in
the view and reset at the top of the view.  My current thinking is:


--- In controller ---
before_filter :myhelper_resetcount

def someaction
end


--- In view ---
<%= myhelper_tag() %>
... Some stuff ...
<%= myhelper_tag() %>
... Some stuff ...
<%= myhelper_tag() %>
...

--- Results ---
<div id="helper_1"> .. </div>
... Some stuff ...
<div id="helper_2"> .. </div>
... Some stuff ...
<div id="helper_3"> .. </div>


Is there another way to do this?  Does this seem reasonable to use the
'before_filter' to reset the count?  It feels a little awkward to me.
This topic is locked and can not be replied to.