Forum: Ruby on Rails Handling file uploads & mixing class and instance vars

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
CSN (Guest)
on 2005-12-23 04:28
(Received via mailing list)
Hey Everybody,

This is the only way I've been able to get my file
upload to work:

class Item < ActiveRecord::Base

  def file=(upload)

  def after_create"public/items/#{}.jpg", "w") {
|f| f.write( }


The upload form has "file_field 'item', 'file', ...".
I've tried using self.file (causes a stack error), and
@id (empty). It just feels wrong mixing class and
instance vars ;). Am I missing something?


Yahoo! for Good - Make a difference this year.
Mark B. (Guest)
on 2005-12-23 04:49
(Received via mailing list)
On Friday 23 December 2005 11:27 am, CSN wrote:
> ... Am I missing something?


Mark B.
Easy Schedule Management
This topic is locked and can not be replied to.