Rendering with erb

why the lucky stiff why at whytheluckystiff.net
Fri Jan 19 17:02:13 EST 2007


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

[1] http://code.whytheluckystiff.net/camping/wiki/CampingExtras


More information about the Camping-list mailing list