File_column


#1

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


#2

finally found a fix for this!

just re-start the server!!!
doh!


#3

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’.


#4

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


#5

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) %>