Ahhh, ok. That worked. And I agree on the helper. Thanks for steering me straight.
Pat On Oct 6, 7:01 pm, Nathan Weizenbaum <[email protected]> wrote: > link_to_if isn't designed to be used with template code in the block. What > you're really looking for is > > = link_to_if(condition, "Name", root_url) {|name| "This is false"} > > It might be a good idea to move this into a helper. Alternately, you could > implement a Haml-specific version using capture_haml that could take a block > of Haml code. > > On Tue, Oct 6, 2009 at 12:54 PM, pcg79 <[email protected]> wrote: > > > I think this is a haml bug as I don't have any problems with this in > > erb. > > > I'm attempting to use link_to_if in my haml view. If the condition is > > false I want it to display specific text so I must pass in a block. > > My example is: > > > = link_to_if(condition, "Name", root_url) do |name| > > = "This is false" > > > When condition is false, I get this: > > > This is false 3 > > > 3 is appended to the end of the string no matter what I enter. If I > > change the haml code to: > > > - link_to_if(condition, "Name", root_url) do |name| > > = "This is false" > > > It correctly handles the false situation but nothing is displayed when > > the condition is true (as you'd expect). > > > Thanks in advanced. > > > Pat > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
