Ruby Forum Ruby on Rails > Markaby template & layout (can't get them to work together)

Posted by Allen Fair (allen)
on 17.12.2006 21:37
Hi all,

I am starting a new rails app with the Markaby plugin (had some issues
installing, but think its working).

First, i created an index.mab file for a controller containing:

  h1 "First template"

That rendered fine. Also, I do not have a "def index ..." in the
controller.

Then I created an app/layouts/application.mab file. It didn't get picked
up until after I restarted the webrick server. However, After I added
this code (from the markaby docs) it failed to render the controller
template.

Tweaking code showed that the index.mab template was still being
processes, but never assigned to @content_for_layout, which is nil.

html do
  head do
    title "hi" #action_name
    stylesheet_link_tag 'scaffold'
  end

  body do
    p flash[:notice], :style => "color: green"
    self << @content_for_layout
  end
end

Is there anything special I forgot to get these Markaby templates to
play together?

Thanks,
Allen

PS - Side question: Is there textmate highlighting for .mab templates?
Posted by Jamie Orchard-Hays (Guest)
on 18.12.2006 00:03
(Received via mailing list)
for TextMate highlighting, just use the ruby syntax coloring.

I seem to remember reading that using a mab file for your layout
isn't recommended, but in any case, I believe @content_for_layout has
been deprecated for yield.

--Jamie