instance method
reset_cycle
Ruby on Rails 2.3.18
Since v2.2.3Signature
reset_cycle(name = "default")
Resets a cycle so that it starts from the first element the next time it is called. Pass in name to reset a named cycle.
Example
# Alternate CSS classes for even and odd numbers...
@items = [[1,2,3,4], [5,6,3], [3,4,5,6,7,4]]
<table>
<% @items.each do |item| %>
<tr class="<%= cycle("even", "odd") -%>">
<% item.each do |value| %>
<span style="color:<%= cycle("#333", "#666", "#999", :name => "colors") -%>">
<%= value %>
</span>
<% end %>
<% reset_cycle("colors") %>
</tr>
<% end %>
</table>
Parameters
-
nameopt = "default"
Source
# File actionpack/lib/action_view/helpers/text_helper.rb, line 478
def reset_cycle(name = "default")
cycle = get_cycle(name)
cycle.reset unless cycle.nil?
end
Defined in actionpack/lib/action_view/helpers/text_helper.rb line 478
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::TextHelper