Using file_column

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…

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 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