Created
September 14, 2009 04:39
-
-
Save technicalpickles/186501 to your computer and use it in GitHub Desktop.
Rails TemplateHandler for using plain ol ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:a => 2, | |
# NOTE for partials, you need to include the format | |
# otherwise, it'll fail to find byows/_byow.erb even if byows/_byow.html.erb exists | |
:b => render(:partial => 'example.html') | |
}.to_json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RbTemplate < ActionView::TemplateHandler | |
include ActionView::TemplateHandlers::Compilable if defined?(ActionView::TemplateHandlers::Compilable) | |
def compile(template) | |
template.source | |
end | |
end | |
ActionView::Template.register_template_handler(:rb, RbTemplate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment