Rendering with erb

James Earl jamesd.earl at gmail.com
Fri Jan 19 17:34:19 EST 2007


On 1/19/07, why the lucky stiff <why at whytheluckystiff.net> wrote:
> On Fri, Jan 19, 2007 at 11:02:37AM -0700, James Earl wrote:
> > Replying to myself... this works, instead of using yield.  Not very
> > pretty I know :)
> >
> > module Test
> >   require 'erb'
> >   def render(m)
> >     content=ERB.new(IO.read("templates/#{m}.html")).result(binding)
> >     layout=ERB.new(IO.read("templates/layout.html")).result(binding)
> >   end
> > end
>
> Hey, nice tip.  You want to add this to the wiki?  A good place
> would be CampingExtras[1].
>
> _why

Thanks!  It's added.  Feel free to improve the code if necessary :)

http://code.whytheluckystiff.net/camping/wiki/CampingAndErb


More information about the Camping-list mailing list