= Haml::Engine.new(list_all_categories(@categories)).render(self) in the view seems render correctly the view helper....
maybe some other tricks will do better ... On 20 jan, 15:39, kadoudal <[email protected]> wrote: > I am progressing in my Haml understanding before switching to it, but > I am stuck for hours with a view helper I cannot make it running > well . > > In my haml view I wrote > > %h3= I18n.t(:category_list) > #category-list > = list_all_categories(@categories) > > and my helper just output all the html code as a STRING .... > > def list_all_categories(categories) > if categories.size > 0 > ret = "<ul>\n" > categories.each { |subcategory| > ret += "<li>\n" > ret += link_to h(subcategory.name), admin_categories_path > ret += link_to " "+h("<add>"), > admin_categories_path > ret += "\n" > if subcategory.children.size > 0 > ret += list_all_categories(subcategory.children) > end > ret += "</li>\n" > } > ret += "</ul>\n" > end > end > > as you noticed I have a nested function in it ... the output html is > correct but it's a string in the view, not the raw html > > what should I use then ? -- 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.
