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

Ticket #10437 (closed enhancement: fixed)

Opened 9 months ago

Last modified 9 months ago

[PATCH] Refactor ActionView TemplateHandlers

Reported by: josh Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc: yanowitz-railstrac-ticket10437@visiblecertainty.com

Attachments

action_view_template_handlers.diff (11.8 kB) - added by josh on 12/09/07 20:52:05.
fixed_test_cases.diff (2.5 kB) - added by josh on 12/10/07 19:23:40.

Change History

12/09/07 20:52:05 changed by josh

  • attachment action_view_template_handlers.diff added.

12/09/07 22:11:14 changed by bitsweat

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

(In [8341]) Refactor Action View template handlers. Closes #10437.

12/10/07 19:22:36 changed by josh

  • status changed from closed to reopened.
  • resolution deleted.

Some test cases need to be updated because they are unpredictable. On my system, builder templates are picked over erb if two have the same name.

I don't think template preference is a real world problem. You won't normally have two templates for the same action and format w/ different handlers.

The patch also sorts the extensions so they are chosen in alphabetical order to avoid differences between systems.

12/10/07 19:23:40 changed by josh

  • attachment fixed_test_cases.diff added.

12/10/07 20:42:03 changed by bitsweat

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

(In [8372]) Fix up template handler tests. Closes #10437.

12/10/07 21:13:30 changed by josh

  • status changed from closed to reopened.
  • resolution deleted.

Sorry, but you missed "actionpack/test/fixtures/test/hello_world_from_rxml.builder" :)

The file got deleted instead of renamed.

12/10/07 21:39:10 changed by josh

Related: More refactorings at http://dev.rubyonrails.org/ticket/10455.

12/10/07 22:36:14 changed by bitsweat

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

(In [8373]) Missed commit. Closes #10437.

12/11/07 18:56:12 changed by yanowitz

  • cc set to yanowitz-railstrac-ticket10437@visiblecertainty.com.

This is just a note in case someone else runs into the same problem. I figured it'd be nice if a search for the error brought you here.

This (very nice) change breaks the current erubis rails handler which relies does its thing in a brute force manner. The refactoring allows for a more elegant approach.

I got this error:

ActionView::TemplateError: undefined method `template_requires_setup?'

A posted a quick fix at http://blog.visiblecertainty.com//articles/2007/12/11/how-to-get-erubis-to-work-with-edgerails-i-e-fixing-undefined-method-template_requires_setup