diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 286defa54e..eef7d1f567 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -267,7 +267,7 @@ module ActionView end options["checked"] = "checked" if checked pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase - options["id"] = @auto_index ? + options["id"] = defined?(@auto_index) ? "#{@object_name}_#{@auto_index}_#{@method_name}_#{pretty_tag_value}" : "#{@object_name}_#{@method_name}_#{pretty_tag_value}" add_default_name_and_id(options) @@ -377,7 +377,7 @@ module ActionView options["name"] ||= tag_name_with_index(options["index"]) options["id"] ||= tag_id_with_index(options["index"]) options.delete("index") - elsif @auto_index + elsif defined?(@auto_index) options["name"] ||= tag_name_with_index(@auto_index) options["id"] ||= tag_id_with_index(@auto_index) else diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 2040c52a71..f668f09d34 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -277,8 +277,7 @@ module ActionView # the next time it is used. def reset_cycle(name = "default") cycle = get_cycle(name) - return if cycle.nil? - cycle.reset + cycle.reset unless cycle.nil? end class Cycle #:nodoc: @@ -305,12 +304,12 @@ module ActionView # guaranteed to be reset every time a page is rendered, so it # uses an instance variable of ActionView::Base. def get_cycle(name) - @_cycles = Hash.new if @_cycles.nil? + @_cycles = Hash.new unless defined?(@_cycles) return @_cycles[name] end def set_cycle(name, cycle_object) - @_cycles = Hash.new if @_cycles.nil? + @_cycles = Hash.new unless defined?(@_cycles) @_cycles[name] = cycle_object end |