Forum: Ruby on Rails file_column problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5375ff5e7386305617e62e732354bff1?d=identicon&s=25 Ben Hiller (Guest)
on 2005-12-31 01:15
I have been trying to use file_column, and it does work partially, the
files are uploaded to my server, but then when I do @user.icon it
returns nil. My file_column definition looks like this: file_column
:icon, :magick => {:size => "100x100" }

I display it in a form (with multipart) like this:
<%= file_column_field 'user', 'icon' %>

I have noticed in the params that the icon is a StringIO (which is
normal for files under 10kb), but icon_temp is nil. I am using
file_column .3.1.

Thanks,
Ben Hiller
B8ed55487e4f2f0feaeb68957dc07b21?d=identicon&s=25 Sebastian Kanthak (Guest)
on 2005-12-31 18:02
(Received via mailing list)
Hi Ben,

On 12/31/05, Ben Hiller <benhiller@gmail.com> wrote:
> I have been trying to use file_column, and it does work partially, the
> files are uploaded to my server, but then when I do @user.icon it
> returns nil. My file_column definition looks like this: file_column
> :icon, :magick => {:size => "100x100" }

have you added a varchar column to your users table? This column will
hold the filename.

Sebastian
5375ff5e7386305617e62e732354bff1?d=identicon&s=25 Ben Hiller (Guest)
on 2005-12-31 23:12
> have you added a varchar column to your users table? This column will
> hold the filename.
>
> Sebastian

Thanks, it now stores the URL, but when I try and access the image, it
gives me a routing error.
6805b35d0a8ea3ede0a7da2d4cf5ae77?d=identicon&s=25 Jonathan Weiss (Guest)
on 2006-01-01 04:57
(Received via mailing list)
Ben Hiller wrote:
>> have you added a varchar column to your users table? This column will
>> hold the filename.
>>
>> Sebastian
>
> Thanks, it now stores the URL, but when I try and access the image, it
> gives me a routing error.
>

Make sure to use a file with an extension like `.pdf`. A file without an
extension like `README` will result in an routing error due to the stuff
in .htaccess or the default lighttpd config.

Jonathan
5375ff5e7386305617e62e732354bff1?d=identicon&s=25 Ben Hiller (Guest)
on 2006-01-01 16:25
> Make sure to use a file with an extension like `.pdf`. A file without an
> extension like `README` will result in an routing error due to the stuff
> in .htaccess or the default lighttpd config.
>
> Jonathan

I am using .jpg's, although could my .htaccess or lighttpd config be
messed incorrect, since I am on Dreamhost?
6805b35d0a8ea3ede0a7da2d4cf5ae77?d=identicon&s=25 Jonathan Weiss (Guest)
on 2006-01-02 10:42
(Received via mailing list)
Ben Hiller wrote:
>> Make sure to use a file with an extension like `.pdf`. A file without an
>> extension like `README` will result in an routing error due to the stuff
>> in .htaccess or the default lighttpd config.
>>
>> Jonathan
>
> I am using .jpg's, although could my .htaccess or lighttpd config be
> messed incorrect, since I am on Dreamhost?
>

If you use Apache it is most likely that they allow you `.htaccess`
files and then it is under your control. But unless you changed it this
problem affects only files with no extension.

How to you access the image?

In the accessing view you need:

<%= url_for_file_column 'user', 'icon' %>



Jonathan
5375ff5e7386305617e62e732354bff1?d=identicon&s=25 Ben Hiller (Guest)
on 2006-01-03 00:36
> How to you access the image?
>
> Jonathan

I use this: <%= image_tag url_for_file_column('user', 'icon'), { :class
=> 'profilepic' } %>
Which is equivalent to what you said, right?
5375ff5e7386305617e62e732354bff1?d=identicon&s=25 Ben Hiller (Guest)
on 2006-01-04 01:33
Ben Hiller wrote:
>> How to you access the image?
>>
>> Jonathan

I figured out the problem. For some reason the images were created with
incorrect permissions, which caused them to not be accessible.
This topic is locked and can not be replied to.