Browse files

Merge pull request #5772 from lest/patch-4

use extract_options! in cycle helper
  • Loading branch information...
2 parents 4b685aa + fd3f550 commit af422bf3c51731320a954ff7c00e0374cfa0eb6c @fxn fxn committed Apr 7, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 actionpack/lib/action_view/helpers/text_helper.rb
View
10 actionpack/lib/action_view/helpers/text_helper.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/string/filters'
+require 'active_support/core_ext/array/extract_options'
module ActionView
# = Action View Text Helpers
@@ -306,12 +307,9 @@ def simple_format(text, html_options={}, options={})
# </tr>
# <% end %>
def cycle(first_value, *values)
- if (values.last.instance_of? Hash)
- params = values.pop
- name = params[:name]
- else
- name = "default"
- end
+ options = values.extract_options!
+ name = options.fetch(:name, "default")
+
values.unshift(first_value)
cycle = get_cycle(name)

0 comments on commit af422bf

Please sign in to comment.