This is a consequence of the way Ruby and Haml work. The function doesn't have access to some of the local variables (namely _hamlout) that Haml needs to run. Thus putting Haml code in the function won't work.
On Fri, Aug 20, 2010 at 11:21 AM, Ashish Bhatia <[email protected]>wrote: > This code snippet http://pastebin.com/nuH20vBQ > produces following error http://pastebin.com/9WThiUHR > > While http://pastebin.com/rkky0Mj8 does the same thing without > producing the error > So, essentially the problem is that any html output (using =) inside a > function call is creating a problem (not just merb helpers which were > mentioned in the original post) > > On Aug 19, 11:38 pm, Nathan Weizenbaum <[email protected]> wrote: > > Can you give an example of the code that's causing this problem? > > > > On Thu, Aug 19, 2010 at 11:15 AM, Ashish Bhatia > > <[email protected]>wrote: > > > > > Hi, > > > > > I have written a ruby function inside haml and calling it from there, > > > but if the function outputs merb form helpers(like select or > > > text_field) > > > the code gives an error "undefined local variable or method `_hamlout' > > > " > > > can someone please help > > > > > Note: I have to perform a ~100 LOC task twice therefore, instead of > > > copying the code , I am doing it using ruby functions in HAML 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]>< > haml%[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] <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.
