# File-column 0.3.1 and different errors depending on the brow

**URL:** <https://www.ruby-forum.com/t/file-column-0-3-1-and-different-errors-depending-on-the-brow/100318>\
**Category:** Rails\
**Created:** [December 13, 2005, 4:44pm UTC](https://www.ruby-forum.com/t/file-column-0-3-1-and-different-errors-depending-on-the-brow/100318 "2005-12-13T16:44:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [December 13, 2005, 4:44pm UTC](https://www.ruby-forum.com/t/file-column-0-3-1-and-different-errors-depending-on-the-brow/100318/1 "2005-12-13T16:44:37Z")

</div>

Ok starting to loose my mind here. And since I am still learing rails  
and ruby this is fast approaching the limit of my knowledge. I took a  
stab out of frustration and opened up firefox to see if I was going  
crazy or not and I got a new error. I am running rails on a mac using  
the locomotive .14.3 max bundle. When I try to upload a file using  
safari (Version 2.0.2 (416.13)) i noticed the following was in the  
parameters dump when I tried to send a file.

Parameters: {“commit”=\>“Update”, “multipart”=\>“true”, “id”=\>“296”,  
“entry”=\>{“image\_temp”=\>""}}

this finally jumped out at me. Where the heck is my image? I selected  
one I know that for sure why is it not in the params list. The  
crazier thing is that a temp directory is getting created where file-  
column says it should however the directory is empty.

I received the following error:

undefined method `original\_filename’ for  
{“image\_temp”=\>""}:HashWithIndifferentAccess

After pulling my hair out I opened up firefox went to the page where  
I upload a file. This time my error page looks like this:

undefined method `original\_filename’ for {“image\_temp”=\>"",  
“image”=\>“5391.jpg”}:HashWithIndifferentAccess

and the parameters dump:

Parameters: {“commit”=\>“Update”, “multipart”=\>“true”, “id”=\>“298”,  
“entry”=\>{“image\_temp”=\>"", “image”=\>“5391.jpg”}}

This shows promise at least the image is showing up in the params  
list. it seems either rails, or locomotive or file-column does not  
like safari as the entry[image] is not getting passed to the  
controller while firefox (1.0.7 as well as firefox 1.5) is at least  
adding the image to my params list but is not liked all that much  
either.

After digging around in the file\_column.rb file that there are some  
special cases for IE but on further review they seem to only swap  
around slashes. This made me curious. I located a windows box in the  
office and tried to upload a file. I did receive the same error on  
firefox as I did with the mac version however on IE I received the  
following:

undefined method `original\_filename’ for #\<HashWithIndifferentAccess:  
0x22573b4\>

with a params list of

Parameters: {“commit”=\>“Update”, “multipart”=\>“true”, “id”=\>“301”,  
“entry”=\>{“image\_temp”=\>"", “image”=\>“C:\Documents and Settings  
\ryarrow\Desktop\image.jpg”}}

now I am new to rails so I took a look at what was special for IE and  
it looks to me (correct me if I am wrong) that this code

filename = File.basename(filename.gsub("\", “/”)) # work-around for IE

is supposed to take those \ slashes and change them to a single /

On to the logs.

it seems no matter what browser I use I am getting the same stack  
trace issue in file\_column

/vendor/plugins/file\_column/lib/file\_column.rb:187:in `store_upload' /vendor/plugins/file_column/lib/file_column.rb:118:in`upload’  
/vendor/plugins/file\_column/lib/file\_column.rb:54:in `assign' /vendor/plugins/file_column/lib/file_column.rb:584:in`image=’  
/vendor/plugins/file\_column/lib/file\_column.rb:583:in `image=’

so I am at least seeing the plugin and trying to give it data. But I  
can’t tell from the logs where it is falling apart on me.

Any thoughts?

Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [December 13, 2005, 5:56pm UTC](https://www.ruby-forum.com/t/file-column-0-3-1-and-different-errors-depending-on-the-brow/100318/2 "2005-12-13T17:56:56Z")

</div>

Ok well I noticed the other file\_column question and so I made a  
change to my form\_tag as I did not know you need the brackets around  
the action however now in firefox I get a similar error while in  
safari I just get a hang and than a lost connection error.

I feel like I am getting close but not sure.

Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [December 13, 2005, 6:18pm UTC](https://www.ruby-forum.com/t/file-column-0-3-1-and-different-errors-depending-on-the-brow/100318/3 "2005-12-13T18:18:14Z")

</div>

Well That was weird. I figured out my issue and so going to put it  
here for others as well. I found that I had use a start\_form\_tag  
instead of form\_tag in my view. I also could not have a  
hidden\_field\_tag I needed to have hidden\_field only in the view.  
Lastly in the controller I had to define add the following to my  
update action:

@entry.update\_attributes(:image =\> params[:entry][:image],  
:response\_label =\> “Nothing”,  
:required =\> “0”)

so my view now looks like this:

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

```
		Your Text:<br/>

		<%= file_column_field 'entry', 'image' %>
		<br/>
		<%= hidden_field('entry', 'id') %>
		<div id="profile_button" >
			<%= submit_tag("Update") %>

```

instead of:

\<%= form\_tag({:action =\> ‘update\_image’}, :multipart =\> true) %\>

```
		Your Text:<br/>

		<%= file_column_field 'entry', 'image' %>
		<br/>
		<%= hidden_field_tag(:id, @entry.id) %>
		<div id="profile_button" >
			<%= submit_tag("Update") %>

```

As I said I am new to ruby and rails so not entirely sure why this is  
the case but it works now.

Andrew
