Skip to content

Instantly share code, notes, and snippets.

@MarkNijhof
Created November 30, 2010 01:09
Show Gist options
  • Save MarkNijhof/720951 to your computer and use it in GitHub Desktop.
Save MarkNijhof/720951 to your computer and use it in GitHub Desktop.
index.haml
- for article in @blog_dorsey.articles.select{|item| item[:published] }[0...5]
= haml :'_article_heading', :layout => false, :article => article <<< passing article to the second partial view?
@nex3
Copy link

nex3 commented Nov 30, 2010

I'm not sure what the feature in question is here. In general, Haml isn't in charge of the rendering methods; that's left up to the host framework (e.g. Rails or Sinatra).

@MarkNijhof
Copy link
Author

Sorry for the late reply back: When I do the following it works fine:

= haml :'_article_heading', :layout => false

But when I try to pass some extra state to the new to be rendered partial view it breaks. But this works fine directly from Sinatra.

What I basically want is to loop through a list of items in the main view and display each item using a sub view. So the sub view needs to have the particular item presented to it.

@nex3
Copy link

nex3 commented Dec 3, 2010

The #haml method you're using here isn't part of Haml; it's part of the host framework (presumably Sinatra).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment