Skip to content

Instantly share code, notes, and snippets.

@ebisawa
Created January 24, 2011 09:02
Show Gist options
  • Save ebisawa/792986 to your computer and use it in GitHub Desktop.
Save ebisawa/792986 to your computer and use it in GitHub Desktop.
sinatra helpers
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