Forum: Ruby on Rails file_column

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.
Fcf5e28e2e7ce245632a4a29896e6799?d=identicon&s=25 Scott (Guest)
on 2006-05-02 11:40
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
<p><label>Quote file</label><br/>
<%= file_column_field "quote", "image" %></p>


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
Fcf5e28e2e7ce245632a4a29896e6799?d=identicon&s=25 Scott (Guest)
on 2006-05-02 12:31
finally found a fix for this!

just re-start the server!!!!
doh!
Fcf5e28e2e7ce245632a4a29896e6799?d=identicon&s=25 Scott (Guest)
on 2006-05-02 12:36
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'.
34f5b045aec62235c17458650ea75353?d=identicon&s=25 Steve Koppelman (hatless)
on 2006-05-02 12:39
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
> <p><label>Quote file</label><br/>
> <%= file_column_field "quote", "image" %></p>
>
> 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
Fcf5e28e2e7ce245632a4a29896e6799?d=identicon&s=25 Scott (Guest)
on 2006-05-02 13:04
Steve Koppelman 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) %>
This topic is locked and can not be replied to.