soveran / cuba

Rum based microframework for web development.
http://cuba.is
MIT License
1.44k stars 249 forks source link

Cuba::Render layouts not working #66

Closed lachholden closed 9 years ago

lachholden commented 9 years ago

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.

kitop commented 9 years ago

@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.

soveran commented 9 years ago

@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.