Hey Ezra
I am actually implementing a SMS gem for merb that i want to put onto
rubyforge. But I thought that to keep the MVC structure id break out
the actual message into a ERB view file. It occurred to me that
ActionMailer renders things directly, so I took a look at that which
is where I got the idea for rendering the template directly.
Perhaps there is a 'more merb' way of handling the templates?
Many thanks
Tim
On 3 Jan 2008, at 19:50, Ezra Zygmuntowicz wrote:
> What are you trying to do exactly? Are you just trying to render a
> template directly? The closest thing to what you are trying there
> would be something like this:
>
> template = "#{MERB_VIEW_ROOT}/articles/index.html.erb"
> engine = Merb::Template.engine_for(template)
> body = engine.transform(:file => template, :view_context =>
> ViewContext.new(self))
>
> The self in the ViewContext.new(self) is a controller instance so
> this code would need to go in your controller somewhere.
>
> This article might help too:
> http://www.timocracy.com/articles/2007/12/17/isolated-controller-and-view-testing-in-merb
>
> Cheers-
>
> - Ezra Zygmuntowicz
_______________________________________________
Merb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/merb-devel