render problem in builder template

Hello guys,

I have a file named "_bar.html.erb" and located at "app/views/foo/" In "app/views/some_path/sample.atom.builder", neither form of the followings worked as expected:       render :partial => 'foo/bar' => MissingTemplate was raised, strange!       render :template => 'foo/_bar' => nil

Is it because Builder and ERB are two different systems so that they can't be mixed together? or because some bug result in the view paths are not properly loaded in builder template

Could anyone help me out? My environment: Rails: 2.3.2 Ruby: 1.8.6

Thanks in advance, Ray

Try this (leading slash): render :partial => '/foo/bar'

Darian Shimy

Hi Darian,

It turned out that in "app/views/some_path/sample.atom.builder", render :partial => 'foo/bar' will looking for a template named "foo/ _bar.atom.erb"( with file extension ".atom"), since such template do not exists, the MissingTemplate exception was raised.

So the solution should be: create a file under the name "foo/_bar.atom.erb" OR call render :partial => "foo/bar.html" (specify file extension explicitly)

Also, thank you for the suggestion

Ray

Ray,

Good find, I didn't know that.

Darian Shimy