thank's for the answer, you finded a elegant solution. I was trying to do it just with one iteration, but now I see your way is better. I moved that line in a model. The h2 comment is ok, but the code I posted it was just a simplified example.
Nice to know there is a community behind HAML able to help the 'noobish' people like me! :D Thank's On 5 mayo, 16:12, "Mislav Marohnić" <[EMAIL PROTECTED]> wrote: > Heh, it would be useful if you posted that pastie along with your original > question; now it's much clearer what you want to do. > > You need 2 nested loops in your template: one that loops through all types > of objects (object names) and creates titles and tables with headers, and > the other one inside it that loops through all objects under that name and > creates table rows. > > To do this, you have to generate some sort of mapping from object type to > all objects under that type. Creating a Hash object usually solves this. I > called this "object_map":http://pastie.caboo.se/191722 > > That line can be extracted in a helper, of course. It's ugly to have these > things in views. > > Also, I recommend using header elements instead of paragraphs if you're > describing a heading. I've used H2 in my pastie. > > On Mon, May 5, 2008 at 3:23 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I want a table for each object with the same name. > > >http://pastie.caboo.se/191699 > > > I want to iterate over the @objects and make a new table when the name > > changes. Is not one table foreach @object, is one table or a row > > depending if the name changed or not. I can't explain it better than > > that with my poor english. > > > On 5 mayo, 03:16, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote: > > > I'm not sure what you're trying to do... do you not want a table for > > > each object? What sort of HTML output are you expecting? > > > > [EMAIL PROTECTED] wrote: > > > > I need help. > > > > > I tried to get a proper solution for a problem with the conditionals > > > > but it was useless. > > > > I need to explore a collection of objects and make tables or rows > > > > depending on its names. I paste the problematic code because my > > > > english sucks and it will be more descriptive. > > > > >http://pastie.caboo.se/191481 > > > > > The code is not working as I want because when I put the else clause > > > > the tbody tag is closed. > > > > I tried using -tab_up but it was useless as well. > > > > > Thank's in advance! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/haml?hl=en -~----------~----~----~----~------~----~------~--~---
