I am using the file_column plugin to upload images. The model that I
am using is simply called images (id, name, caption - name being the
“file” column) and it belongs_to a parent model called books which
has_many images. I was able to figure out how to enter the images
into the correct model when updating of form of the parent model
(books). Now I need to figure out how to view the images in simple
display view of the parent model (books).
I am not sure about the syntax of the url_for_file_column helper.
Here is what I have so far:
<% for image in @book.images %>
<% end %>
Which produces the following error:
You have a nil object when you didn’t expect it!
The error occured while evaluating nil.image.name_relative_path
I also have a more general question about this function. How could
url_for_file_column figure out which model object (record) to display
if we are only to pass it the names of the model and relevant
attribute? Shouldn’t we have to pass it an ID as well?