Turning off file_column ...possible?

The file_column plugin is great, but I’ve run into a case where I’d like
to turn it off for an instance. My app has a ‘demo’ mode, which needs to
create a few rows of data on demand – one column in which is defined by
file_column. I cannot simply say:

@picture = Picture.new
@picture.filename = “/tmp/filename.jpg”

file_column will, of course, complain. But this is exactly what I’d like
to do.

Currently, I have to go out of my way to make file_column happy by
creating a StringIO object that reads in the path of the file. While
this works, it’s much slower than simply being able to save the filename

So is this possible? Maybe those with greater Ruby knowledge than I know
of a way to remove any refernce to file_column one moment, and in the
next, turn it back on.


Is there any chance you could reuse a “Picture” that already exists?

Carl F. wrote:

Is there any chance you could reuse a “Picture” that already exists?

Not in this case. Each demo user needs their own data (it’s not a
problem that they’re pointing to the same image on the filesystem,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs