Cuba::Render layouts not working
lachholden opened this issue · comments
Lachlan Holden commented
Hi, I'm having trouble using render
from Cuba::Render - I get a LocalJumpError "no block given (yield)".
My setup is as follows:
# app.rb
require 'cuba'
require 'cuba/render'
require 'haml'
require 'tilt/haml'
Cuba.plugin Cuba::Render
Cuba.settings[:render][:template_engine] = 'haml'
Cuba.define do
on root do
render 'dashboard'
end
end
-# views/layout.haml
!!!5
%html
%head
%title Title
%body
= yield
-# views/dashboard.haml
%h1 Dashboard
Accessing the root page gives the LocalJumpError as above.
Esteban Pastorino commented
@lachy-xe instead of = yield
try using = content
.
Cuba::Render works a bit differently from Rails and Sinatra in the way it deals with the layout. The above should work.
Michel Martens commented
@lachy-xe Were you able to make it work with what @kitop explained? I'm closing this issue, but feel free to keep commenting if you need help.