In general, using a template allows Haml's optimization mechanisms to kick
in, prerendering all the HTML it can. If you just haml_puts the result of
the #render call, that should perform better.

On Sun, Nov 14, 2010 at 8:03 PM, steve ross <[email protected]> wrote:

> On Nov 14, 2010, at 2:26 PM, Nathan Weizenbaum wrote:
>
> > capture_haml only captures strings that are concatenated directly to the
> template. render :partial actually returns the string result rather than
> concatenating it, so that's why capture_haml isn't working here.
> >
> > On Sun, Nov 14, 2010 at 1:22 PM, steve ross <[email protected]> wrote:
> > In a helper that renders partials can I use capture_haml?
> >
> > e.g.,
> >
> >  def mapped_downloads(download_hash)
> >    s = capture_haml do
> >      download_hash.map do |date, downloads|
> >        downloads.sort{|o, other| other[:id] <=> o[:id]}.each do |d|
> >          render :partial => 'detail_row', :locals => {:d => d, :date =>
> date} if d.download_date > 15.days.ago.to_date || Rails.env == 'test'
> >        end
> >        render :partial => 'subtotal', :locals => {:downloads =>
> downloads, :date => date}
> >      end
> >    end
> >    s
> >  end
> >
> > I'm not seeing anything from:
> >
> > = mapped_downloads(@downloads)
> >
> > in my view code. Help?
> > \
>
> Thanks Nathan.
>
> I rewrote this, expressing the contents of the partials in methods
> contained in the helper using haml_puts. Oddly, the performance suffered. Is
> there any caching goodness associated with using render or is this something
> that's buried someplace in my code.
>
> --
> 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] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>
>

-- 
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.

Reply via email to