ActionView::TemplateError (can’t convert nil into String) on line #1
of accounts/_createturing.rhtml:
1: <%= image_tag( createturing ) %>
By default when looking at the partial createturing rails will set the
local variable createturing to the value of @createturing which would
seem to be nil.
You however don’t want to use the local variable createturing but the
method of the same name. You can force a method call by saying
createturing() instead of createturing
It’s because you’re trying to pass a local variable to a partial, and
that
won’t work. Change it to an instance variable or specify :locals => {
:variable_name => variable_name } in your partial.
–
Ryan B.
Feel free to add me to MSN and/or GTalk as this email.
ok i’m having problems moving a piece of code into a partial
I have a line in a view:
<%= image_tag( createturing ) %>
moving to a partial _createturing.rhtml and changing the view to:
<%= render(:partial => "createturing") %>
gives errors:
ActionView::TemplateError (can't convert nil into String) on line #1
of accounts/_createturing.rhtml:
1: <%= image_tag( createturing ) %>
what changes do i need to make when i move it into the partial?
btw: the function createturing is in a helper if that makes a
differance!
i think the render line should be:
<%= render :partial => ‘createturing’ %> without the brackets~
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.