Created
January 24, 2011 09:02
-
-
Save ebisawa/792986 to your computer and use it in GitHub Desktop.
sinatra helpers
This file contains 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
helpers do | |
include Rack::Utils | |
alias_method :h, :escape_html | |
alias_method :u, :escape | |
def partial(renderer, template, options = {}) | |
options = options.merge({:layout => false}) | |
template = "_#{template.to_s}".to_sym | |
m = method(renderer) | |
m.call(template, options) | |
end | |
def partial_erb(template, options = {}) | |
partial(:erb, template, options) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment