No. This is a fairly serious bug in Merb. Helpers that take blocks in Merb use <%= %>. It will be fixed on edge in about 10 minutes.
-- Yehuda On Fri, Nov 7, 2008 at 1:04 AM, Lawrence Pit <[EMAIL PROTECTED]> wrote: > > > I consider it a bug in the doc. > > It's not the only error: > > <%= fields_for :permission do %> > > should read: > > <%- fields_for @permission do %> > > which I reported earlier at > > > http://merb.lighthouseapp.com/projects/7433/tickets/932-fields_for-does-not-work-as-advertised > > and which is marked as resolved for final 1.0, though neither in the master > nor in the active branch of wycats repository can I see that the doc has > actually been modified. > > > > Lawrence > > > Oh really! Thanks for your help - that does indeed work, but I'm > puzzled about why. AFAIK I'm not misreading what I take to be ='s in > the example code in the API docs - > http://merbivore.com/documentation/0.9.9/doc/rdoc/stack/index.html?a=M000511&name=fields_for > > and I'm pretty sure I've seen the = usage mentioned somewhere as > applying to any helper that takes a do-end block. > > I'm familiar with the use of a trailing minus to suppress line feeds, > but I guess this is something different. Can someone explain to me > what the general rule is here or point me at some documentation? > > Mark > > > On Nov 6, 11:05 pm, Lawrence Pit <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > wrote: > > > Mark, > > you need to do: > > <%- fields_for > > with a minus sign > > Lawrence > > > > I'm in the process of trying to migrate a Rails app I started working > on recently to Merb. I've run into some behavior that I don't > understand. > > > I have two nested partials that render a "fields_for" inside a > "form_for". The weirdness is that the part of the inner partial gets > rendered twice. Here are the details... > > > ---- new.html.erb ---- > <div> > <%= partial :form %> > </div> > -------------------------- > > > ---- _form.html.erb ---- > <%= form_for @an_object do %> > > > <%= partial :fields %> > > > <% end =%> > ---------------------------- > > > ---- _fields.html.erb ---- > Yo > <%= fields_for @another_object do %> > > > ho ho > > > <% end =%> > > > <div> > and a bottle of rum > </div> > ----------------------------- > > > ---- browser output ---- > Yo ho ho Yo ho ho > and a bottle of rum > ----------------------------- > > > Just to add to my puzzlement, if I remove the = from the erb > delimiters for "field_for" and its corresponding "end" (like you would > in Rails), the repetition of Yo ho ho goes away. > > > Am I doing something wrong here? Or is this just strange? > > > Mark. > > > > > > > -- Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" 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/merb?hl=en -~----------~----~----~----~------~----~------~--~---
