aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2012-04-07 22:03:17 +0300
committerSergey Nartimov <just.lest@gmail.com>2012-04-07 22:03:17 +0300
commitfd3f550c949fda5d3f9d008bf90091dc151d006f (patch)
treea6c6517ed80e85090b410782dc5f96ba5f5986c8
parentbcd22696585b6be6f088780b37195ad0b1ff0fde (diff)
downloadrails-fd3f550c949fda5d3f9d008bf90091dc151d006f.tar.gz
rails-fd3f550c949fda5d3f9d008bf90091dc151d006f.tar.bz2
rails-fd3f550c949fda5d3f9d008bf90091dc151d006f.zip
use extract_options! in cycle helper
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 3dc651501e..eb806f44cf 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/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 @@ module ActionView
# </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)