Note that there are some explanatory texts on larger screens.

plurals
  1. POHAML layout.haml and Sinatra not working with url parameters
    primarykey
    data
    text
    <p>My index.haml is working fine with, for example:</p> <pre><code>get '/about' do haml :about end </code></pre> <p>But if I try to use a user parameter like:</p> <pre><code>get ':user/add' do haml :add_item end </code></pre> <p>The layout.haml is ignored.</p> <p>I was trying to get this to work using subdirectories in my view folder like:</p> <p>/view/contact/add.haml</p> <p>While it inserts the =yield content, it will not show the layout.haml css styles, etc.</p> <p>So I thought using subdirectories was the issue and put all my hamls in the base views directory. However it seems that anything using a url parameter like get ':user/add' does not incude the layout.haml regardless. Currently this is a test I did:</p> <p><strong>myapp.rb</strong></p> <pre><code>require "rubygems" require "sinatra" require "haml" require "data_mapper" require "pony" get '/' do #works fine haml :index end get '/:user_id/dashboard' do #recognizes the content but ignores layout.haml haml :dashboard end </code></pre> <p>my <strong>layout.haml</strong> looks like this:</p> <p><strong>views/layout.haml</strong></p> <pre><code>!!! %html %head %title Testing haml and sinatra %link(rel="stylesheet" href="css/style.css") %body #wrapper #header %h1 HAML Test Template %h2 Made with Sinatra and HAML! #navigation %h1 Navigation #sidebar %h1 Sidebar #content =yield #footer %p This is the footer. </code></pre> <p>Any help would be much appreciated. Thanks.</p> <p><em>I don't know if it matters but I'm using shotgun for development</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload