I'd recommend against having such a long line in Haml. Although it will
work, it's ugly. I'd do something like
- if @product_pages.current.previous
= link_to 'Previous page', :page => @product_pages.current.previous
Or even move it into a helper:
def previous_page_link
if prev_page = @product_pages.current.previous
link_to 'Previous page', :page => prev_page
end
end
= previous_page_link
Also, note that you don't need brackets around the hash if it's the last
argument.
- Nathan
Brett Rogers wrote:
> Try using the "=" instead of "-"
>
> Regards,
> Brett
>
> On 8/3/07, *florent* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
>
>
> Hello,
>
> I am new to Haml and I try to apply it along reading Agile Web
> Development with Rails. How can I convert this line of rhtml?
>
> <%= link_to 'Previous page',
> { :page => @product_pages.current.previous } if
> @product_pages.current.previous %>
>
> The mere translation
> - link_to 'Previous page', { :page =>
> @product_pages.current.previous } if @product_pages.current.previous
> does not work.
>
> Thanks by advance!
>
> Florent
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---