# File\_column

**URL:** <https://www.ruby-forum.com/t/file-column/94364>\
**Category:** Rails\
**Created:** [May 2, 2006, 11:40am UTC](https://www.ruby-forum.com/t/file-column/94364 "2006-05-02T11:40:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 2, 2006, 11:40am UTC](https://www.ruby-forum.com/t/file-column/94364/1 "2006-05-02T11:40:12Z")

</div>

Gi,

Im attempting to use the file column plugin, but having a few problems.

In quote.rb I have  
class Quote \< ActiveRecord::Base  
file\_column :image

has\_one :project  
end

then In my \_form.rhtml, I have

Quote file  
\<%= file\_column\_field "quote", "image" %\>

However im gaining this error message, is there somthing I hneed to  
place in quotes\_controller to get this to work? or any other suggestions  
to what could be going wrong?

NoMethodError in QuotesController#new

undefined method `file\_column’ for Quote:Class

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 2, 2006, 12:31pm UTC](https://www.ruby-forum.com/t/file-column/94364/2 "2006-05-02T12:31:28Z")

</div>

finally found a fix for this!

just re-start the server!!!  
doh!

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 2, 2006, 12:36pm UTC](https://www.ruby-forum.com/t/file-column/94364/3 "2006-05-02T12:36:07Z")

</div>

Scott wrote:  
well fixed that error by re-starting the server!!

but when i submit the form with a url I now get this error

TypeError in QuotesController#create

Do not know how to handle a string with value ‘tests.doc’ that was  
passed to a file\_column. Check if the form’s encoding has been set to  
‘multipart/form-data’.

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 2, 2006, 12:39pm UTC](https://www.ruby-forum.com/t/file-column/94364/4 "2006-05-02T12:39:29Z")

</div>

Also make sure you have a :string/varchar field called “image” in the  
quotes table of your database.

Scott wrote:

> Im attempting to use the file column plugin, but having a few problems.
> 
> In quote.rb I have  
> class Quote \< ActiveRecord::Base  
> file\_column :image
> 
> has\_one :project  
> end
> 
> then In my \_form.rhtml, I have
> 
> Quote file  
> \<%= file\_column\_field "quote", "image" %\>
> 
> However im gaining this error message, is there somthing I hneed to  
> place in quotes\_controller to get this to work? or any other suggestions  
> to what could be going wrong?
> 
> NoMethodError in QuotesController#new
> 
> undefined method `file\_column’ for Quote:Class

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 2, 2006, 1:04pm UTC](https://www.ruby-forum.com/t/file-column/94364/5 "2006-05-02T13:04:44Z")

</div>

Steve K. wrote:

> Also make sure you have a :string/varchar field called “image” in the  
> quotes table of your database.

yeah thanks, got it set a text field, but seems to work

looks like i was forgetting to set the multipart

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