# File\_column just will not work

**URL:** <https://www.ruby-forum.com/t/file-column-just-will-not-work/101469>\
**Category:** Rails\
**Created:** [August 5, 2006, 3:22am UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469 "2006-08-05T03:22:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scoobycoder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@scoobycoder](https://www.ruby-forum.com/u/scoobycoder)\
**Post date:** [August 5, 2006, 3:22am UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469/1 "2006-08-05T03:22:45Z")

</div>

Hello,

I have been trying for some time to get a file to upload using the  
file\_column plugin.

My code is here: [Parked at Loopia](http://pastie.caboo.se/7304)

But my code is not the issue. I cannot even pass the unit test that  
come with the file\_column plugin.

If I run ruby file\_column\_test.rb i get:

1. Error:  
test\_store\_dir\_callback(FileColumnTest):  
TypeError: can’t convert Fixnum into String  
file\_column\_test.rb:204:in `join' file_column_test.rb:204:in `test\_store\_dir\_callback’

If I run the rmagick tester file, I get 6 failures. Is it possible that  
rmagick would keep file\_column from functioning at all?

When I try to upload a file, it just passes null to the DB and doesn’t  
even download the file to the /tmp folder.

Any suggestions would be great. I will be working on trying to see if  
rmagick is working or not, but I doubt that would keep the file from  
uploading at all.

## Thanx for you time.

://  
Nathan H.

---

<div class="post-metadata">

**Author:** ![scoobycoder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@scoobycoder](https://www.ruby-forum.com/u/scoobycoder)\
**Post date:** [August 5, 2006, 11:36pm UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469/2 "2006-08-05T23:36:39Z")

</div>

On 04/08/06, Nathan H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. Error:  
> test\_store\_dir\_callback(FileColumnTest):  
> TypeError: can’t convert Fixnum into String  
> file\_column\_test.rb:204:in `join' file_column_test.rb:204:in `test\_store\_dir\_callback’

I think it ought to read:  
assert\_equal\_paths File.join(RAILS\_ROOT, “public”, “my\_store\_dir”,  
e.id.to\_s),  
e.image\_dir  
In lieu of  
assert\_equal\_paths File.join(RAILS\_ROOT, “public”, “my\_store\_dir”,  
e.id),  
e.image\_dir

The svn diff is stored at  
[http://prolificprogrammer.com/~hdiwan/file\_column.patch](http://prolificprogrammer.com/~hdiwan/file_column.patch)

---

<div class="post-metadata">

**Author:** ![scoobycoder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@scoobycoder](https://www.ruby-forum.com/u/scoobycoder)\
**Post date:** [August 7, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469/3 "2006-08-07T16:54:39Z")

</div>

On 2006-08-05 17:35:06 -0400, “Hasan D.”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) said:

> I think it ought to read:  
> assert\_equal\_paths File.join(RAILS\_ROOT, “public”, “my\_store\_dir”, e.id.to\_s),  
> e.image\_dir

Thanx for that. I now pass every test but one, actually uploading a  
file. It never actually takes the file from my hard drive.

1. Failure:  
test\_with\_image\_tag(UrlForFileColumnTest)  
[file\_column\_helper\_test.rb:80]:  
\<“/foo/bar/entry/image/tmp/1154962075.100369.19508/skanthak.png?1154962075”\>  
expected to be =~  
\</^/foo/bar/entry/image/.+/skanthak.png$/\>.

When I try to write my own rails app to upload a file, it doesn’t even  
return a tmp directory…

I am going to have to roll my own now, but I really like the way  
file\_column handles uploads.

## If anyone has any suggestions, thanx.

://  
Nathan H.

---

<div class="post-metadata">

**Author:** ![scoobycoder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@scoobycoder](https://www.ruby-forum.com/u/scoobycoder)\
**Post date:** [August 15, 2006, 2:09pm UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469/4 "2006-08-15T14:09:13Z")

</div>

On 2006-08-07 11:35:35 -0400, “Carl F.”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) said:

> I have a feeling that it is as simple as your multipart isn’t working.

It’s one of those things isn’t it. I noticed that too and repaired it.  
Thanx.

It wasn’t the only problem I had left. I had a bad install of image  
magick and had to reinstall it, but I got er workin.

## There needs to be a gem install all\_the\_crap\_i\_need\_for\_me 😉

://  
Nathan H.

---

<div class="post-metadata">

**Author:** ![scoobycoder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@scoobycoder](https://www.ruby-forum.com/u/scoobycoder)\
**Post date:** [August 7, 2006, 5:39pm UTC](https://www.ruby-forum.com/t/file-column-just-will-not-work/101469/5 "2006-08-07T17:39:46Z")

</div>

I have a feeling that it is as simple as your multipart isn’t working.  
Try this:

\<%= start\_form\_tag({:action =\> ‘create’}, :multipart =\> true)%\>

It seems dumb, but from the looks of your Firefox output, the  
multipart is being passed as a parameter. Look at the actual HTML that  
is being produced to verify that the form tag is being built properly.
