As a simplified example of what I'm trying to do, say I'm displaying a
bunch of Posts on a page.  My partial would look something like this:

- @posts.each do |post|
  %a{:href => post.link}
  %p= post.body

But what I want to do is set an attribute on the link for the *last*
post of the page like

- @posts.each do |post|
  %a{:href => post.link, :title => ("last post" if post ==
posts.last)}
  %p= post.body

I've tried the above code but I get an error saying can't compare to
nilClass, and I'm not sure why either the sender or receiver would be
nil, as the things I'm rendering show properly (all of them).

Any ideas what I'm doing wrong?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to