Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11237 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

[PATCH] Removing unused and broken method 'to_date_tag' from ActionView helpers

Reported by: danger Assigned to: bitsweat
Priority: low Milestone: 2.x
Component: ActionPack Version: edge
Severity: minor Keywords: patch
Cc:

Description

There's a lovely method in form_helper.rb that is wrong in so many ways. It has a non-standard method definition (empty paretheses), it's not called by any other helper, it's untested, it has it's own constant DEFAULT_DATE_OPTIONS that's is unused elsewhere and best of all it's completely broken - It calls methods that don't exist.

Here it is:

      def to_date_tag()
        defaults = DEFAULT_DATE_OPTIONS.dup
        date     = value(object) || Date.today
        options  = Proc.new { |position| defaults.merge(:prefix => "#{@object_name}[#{@method_name}(#{position}i)]") }
        html_day_select(date, options.call(3)) +
        html_month_select(date, options.call(2)) +
        html_year_select(date, options.call(1))
      end

And by applying the attached patch we can make it go away!

Attachments

remove_unused_and_broken_to_date_tag_method.diff (1.6 kB) - added by danger on 02/27/08 23:45:36.

Change History

02/27/08 23:45:36 changed by danger

  • attachment remove_unused_and_broken_to_date_tag_method.diff added.

03/13/08 18:46:15 changed by josh

  • owner changed from core to bitsweat.

+1

03/13/08 18:49:52 changed by bitsweat

Ha ha! WTF..

03/13/08 19:18:48 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [9024]) Remove unused to_date_tag. Closes #11237 [danger]