instance method
current_cycle
Ruby on Rails 8.0.4
Since v2.2.3Signature
current_cycle(name = "default")
Returns the current cycle string after a cycle has been started. Useful for complex table highlighting or any other design need which requires the current cycle string in more than one place.
<%# Alternate background colors %>
<% @items = [1,2,3,4] %>
<% @items.each do |item| %>
<div style="background-color:<%= cycle("red","white","blue") %>">
<span style="background-color:<%= current_cycle %>"><%= item %></span>
</div>
<% end %>
Parameters
-
nameopt = "default"
Source
# File actionview/lib/action_view/helpers/text_helper.rb, line 461
def current_cycle(name = "default")
cycle = get_cycle(name)
cycle.current_value if cycle
end
Defined in actionview/lib/action_view/helpers/text_helper.rb line 461
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::TextHelper