under the following development environment: OS X 10.3, Apache 1.3, MySQL, FCGI When attempting to display an uploaded images path like so: <%= url_for_file_column(''item'', ''image'') %> I get: undefined method `image_options'' for nil:NilClass Seeing that the issue comes from the url_for_file_column method, I attempted to circumvent it by coding it statically: "/item/image/<%= item.id %>/<%= item.image %>" this actually outputs: /item/image/9//Library/WebSever/httproot/lee/dev/item/image/9/test.png The absolute path is being appended to the path I''m constructing. This behavior seems to be caused by the FileColumn :image declaration in my model, since, when I remove it, I get only the filename from the database, which is what I was looking for.. this is obviously not a solution though, as that keeps the upload portion from working :( I think this is one of those situations where the Magic of the Ruby (and/or FileColumn, as there''s definitely some code in there I don''t grok) has pulled a veil over my eyes... can someone shed some light on this? Thanks, Stephen
Hi Stephen, Stephen Caudill wrote:>under the following development environment: >OS X 10.3, Apache 1.3, MySQL, FCGI > >When attempting to display an uploaded images path like so: > ><%= url_for_file_column(''item'', ''image'') %> > >I get: > >undefined method `image_options'' for nil:NilClass > > >url_for_file_column expects an instance variable (e.g. "@item" in your case). However, it seems "item" is just a local variable? Try to put the Item object in an "@item" variable in your controller.>Seeing that the issue comes from the url_for_file_column method, I >attempted to circumvent it by coding it statically: > >"/item/image/<%= item.id %>/<%= item.image %>" > >this actually outputs: > >/item/image/9//Library/WebSever/httproot/lee/dev/item/image/9/test.png > > >right, when you declare "image" as a file column, the image method will return the absolute path to the file. You can access just the filename by "item[''image'']", or the relative path ("9/test.png" in your case) via "item.image_relative_path". I''ll try to clarify this even more in the docs although it should be explained there already. Hope this helps Sebastian