Hi Tim-
On Jan 3, 2008, at 11:13 AM, Tim Perrett wrote:
> Hey All
>
> Quick question, what's the merb equivalent of this:
>
> ActionView::Base.new([template_root], assigns, self)
>
> in merb? Ive found
>
> Merb::Template::Erubis.transform(:file => '/path/to/file')
>
> But I've no idea if thats the correct thing to be calling? It doesn't
> 'feel' right, so im not sure it is?
>
> Thanks
>
> Tim
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
-- Founder & Software Architect
-- [EMAIL PROTECTED]
-- EngineYard.com
_______________________________________________
Merb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/merb-devel