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

Ticket #7460 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

[PATCH] Changeset 6052 breaks rescues for missing helpers

Reported by: packagethief Assigned to: ulysses
Priority: high Milestone: 1.x
Component: ActionPack Version: edge
Severity: normal Keywords: helpers loaderror rescues verified
Cc:

Description

Changeset #6052 (fix overly greedy rescues when loading helpers) rescues a LoadError exception and calls is_missing? on it. is_missing? is defined on MissingSourceFile, (a subclass of LoadError), but not on LoadError itself, hence, a NoMethodError is raised.

NoMethodError (undefined method `is_missing?' for #<LoadError:0x3774c24>):
    ./vendor/rails/actionpack/lib/action_controller/helpers.rb:114:in `default_helper_module!'
    ./vendor/rails/actionpack/lib/action_controller/helpers.rb:126:in `inherited'

This occurs if the default helper module is not present.

Attachments

helpers_rescue_fix.diff (0.6 kB) - added by ntalbott on 09/26/07 21:14:15.

Change History

02/01/07 21:53:40 changed by packagethief

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

Correction: the LoadError is only raised when the included file fails to define the expected module. If the file can't be found, it correctly raises MissingSourceFile.

09/26/07 21:11:11 changed by ntalbott

  • status changed from closed to reopened.
  • resolution deleted.
  • severity changed from major to normal.

Re-opening, because even though it is true that MissingSourceFile is correctly raised in some cases, in other cases this bug causes unfortunate masking of actual errors, i.e. a helper file that doesn't define the properly named helper module.

09/26/07 21:14:15 changed by ntalbott

  • attachment helpers_rescue_fix.diff added.

09/26/07 21:14:44 changed by ntalbott

  • summary changed from Changeset 6052 breaks rescues for missing helpers to [PATCH] Changeset 6052 breaks rescues for missing helpers.

Added a patch to fix.

09/26/07 21:35:11 changed by packagethief

+1

09/26/07 23:07:23 changed by nzkoz

  • keywords changed from helpers loaderror rescues to helpers loaderror rescues verified.

+2 :), I will apply when I get a moment unless one of my fellow committers beats me to it.

09/27/07 05:04:05 changed by ulysses

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

(In [7644]) Avoid calling is_missing on LoadErrors. Closes #7460.

09/27/07 05:04:36 changed by ulysses

first! ;)