Forum: Ruby on Rails using file_column

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Curtis E. (Guest)
on 2006-04-22 10:59
(Received via mailing list)
I'm trying out this recipe from the Rails Recipes book (the tagging one)
I'm also trying to use file_column to handle the uploading of pictures.
Basically I think the problem is I'm not using an instance variable in
view's partial that shows the details of my item. Off of my original
list.rhtml page I have a

<%= render :partial => "detail", :collection => @recipes %>

then in my details partial i have a

<%= render :partial => "content", :locals => {:recipe => detail,
:form_id =>
form_id} %>

so in my content partial I'm using local variables.

Now if I just try to add

<%= image_tag url_for_file_column("recipe", "image") %>

I get

You have a nil object when you didn't expect it! The error occured while
evaluating nil.image_relative_path

I've tried a couple of simple ways to use an instance variable but it
worked properly...
Szymon N. (Guest)
on 2006-04-22 12:56
You could use latest (svn) version of file_column plugin, which is
supposed to work with non-instance variables or just write "@recipe =
recipe" before <%= image_tag url_for...
This topic is locked and can not be replied to.