Skip to content

Instantly share code, notes, and snippets.

@ThijsWouters
Last active August 29, 2015 14:17
Show Gist options
  • Save ThijsWouters/4d47175e5997a637d271 to your computer and use it in GitHub Desktop.
Save ThijsWouters/4d47175e5997a637d271 to your computer and use it in GitHub Desktop.
A bug in mustache-sinatra
$:.unshift File.dirname(__FILE__)
require 'sinatra'
require 'mustache/sinatra'
class Example < Sinatra::Base
register Mustache::Sinatra
get '/' do
mustache :index, layout: false
end
end
root = File.dirname __FILE__
require "#{root}/app"
map "/" do
run Example
end
class Example
module Views
class Index < Mustache
def view
'From view'
end
end
end
end
<html>
<head>
<title>OK</title>
</head>
<body>
<h1>From template</h1>
<h1>{{view}}</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment