I wanted to do something like this: <%= borderless_table do %> Something inside a cell <%= end %> def borderless_table %Q( <table class=''borderless''> <tr> <td> #{ yield } </td> </tr> </table>) end ... but I quickly discovered that erb doesn''t like that: (erb):55: syntax error _erbout.concat(( borderless_table() do ).to_s); _erbout.concat "\n" ^ Is there some way around this? I''d love to be able to make blocks work as beautifully as that in my helpers. Thanks, Duane Johnson (canadaduane)
On May 5, 2005, at 8:22 PM, Duane Johnson wrote:> I wanted to do something like this: > > <%= borderless_table do %><% borderless_table do %>> Something inside a cell > <%= end %><% end %>> > def borderless_table > %Q( > <table class=''borderless''> > <tr> > <td> > #{ yield } > </td> > </tr> > </table>) > endjeremy
On May 5, 2005, at 9:22 PM, Duane Johnson wrote:> I wanted to do something like this: > > <%= borderless_table do %> > Something inside a cell > <%= end %>As Jeremy noted, you have a = in there that you do not want. Also, make sure that you define your method before you try to use it (top of the ERB file, or elsewhere) not after.
<% @borderless_table = capture do %> <table></table> <% end %> http://rails.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html On 5/6/05, Gavin Kistner <gavin-XtLdkLkwz3ZWk0Htik3J/w@public.gmane.org> wrote:> On May 5, 2005, at 9:22 PM, Duane Johnson wrote: > > I wanted to do something like this: > > > > <%= borderless_table do %> > > Something inside a cell > > <%= end %> > > As Jeremy noted, you have a = in there that you do not want. > > Also, make sure that you define your method before you try to use it > (top of the ERB file, or elsewhere) not after. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- rick http://techno-weenie.net