views:

38

answers:

1

I just upgraded to Rails3, Ruby 1.9.2 and the latest HAML gem. This code used to work:


  = allowed? do
    = link_to('New', new_video_path)

Now allowed? yields 0.

It works if I do:


  = allowed?{ link_to('New', new_video_path) }

What gives?

A: 

Why are you echoing the output of that in the first place? You should be doing:

- allowed? do
  = link_to('New', new_video_path)

In general, you never want to use the output operator (=) with a block. Stuff outputted in blocks doesn't get returned to the block; it's concat'd directly into the buffer. Using a block like that is likely to produce errors with content out of order.

Chris Heald
I do it that way normally, but Rails 3 complains with a deprecation error...
Matt Darby