Permalink
Browse files

use extract_options! in cycle helper

  • Loading branch information...
lest committed Apr 7, 2012
1 parent bcd2269 commit fd3f550c949fda5d3f9d008bf90091dc151d006f
Showing with 4 additions and 6 deletions.
  1. +4 −6 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 fd3f550

Please sign in to comment.