Render file doesn't do anything

Hi,
the following piece code has been troubling me for a couple of days
now:

<% render :file => “…/…/public/images/projects/” + @project + “/
project.html” %>

it is in the index.html.erb file of a controller. I know that is not
really the intended use of the render function but for project
specific reasons i would like to do it like that. the integrated dev
webserver returns the following message:

Rendered public/images/projects/Jonas/_project.html (0.4ms)

so i assume the render was sucessfull but the problem is the html that
was supposed to be rendered is not in the resulting html file. it is
as if the render statement wasn’t there.
just to be sure I tried another way as well. because render file =>
expects a file with an absolute path i did the following

<% file = File.open(“public/images/projects/” + @project + “/
project.html”) %>
<% render :inline => File.expand_path(file.path) %>

again the server reports sucess but there is nothing…at least not
what is supposed to be there.
So i have no idea what else to do. i could not find any answer in this
mailinglist or via stackoverflow (http://stackoverflow.com/questions/
5572098/rails-render-doesnt-do-anything)

i hope you guys will have a suggestion…thanks allready
jan

On Apr 10, 5:59pm, jan [email protected] wrote:

Hi,
the following piece code has been troubling me for a couple of days
now:

<% render :file => “…/…/public/images/projects/” + @project + “/
project.html” %>

<% never outputs anything. You want <%= instead.

Fred

omg…thank you so much for enlightenment :slight_smile:
would have driven me crazy

thank you so much

Jan

Am Sonntag, den 10.04.2011, 23:58 -0700 schrieb Frederick C.:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs