I read the documentation and at one point it says to "require
[rails_file_column.rb] file from your 'config/environment.rb' (after
rails has been loaded) to integrate the file_column extension into
rails."
Did you put the plugin under /vendor/plugins/? Then you needn't any
requirements of this Plugin in your environment.
i had the same problem when i first tried file_column. i figured it
out by reading through 'file_column_helper.rb' that is installed with
the plugin in the lib directory. here's what i found:
object = instance_variable_get("@#{object.to_s}")
basically it gets a reference to the _INSTANCE_ variable that is being
referred to by the first string you pass to url_for_file_column.
this means that in your case you need a variable named "@product" that
holds a reference to the product you're trying to display the image
of. For instance, just try adding this to the top of your template and
see what happens.
<% @product = product %>
a cleaner solution would probably be to set this instance variable
somewhere inside the controller that renders your template code.
I encounter the same problem. What I did is change
<%= image_tag url_for_file_column("product", "image_url") %>
to
<%= image_tag url_for_file_column(product, "image_url") %>
and it works.
This is inspired by Jason S.'s post above, in 'file_column_helper.rb',
it will check if
the first parameter is a string or symbol, and tries to get the object
from it.
Since in your case, product is already an obj, you can just pass it in
directly.