Forum: Ruby on Rails Question about file_column plugin

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.
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-03-06 09:15
Hi!

File_column plugin saves uploaded files to
"public/model/image/model_id/filename", if i understand it correctly.
Does it mean that it creates new folder for every image?

I have product (model) that has_many images (model). Is it possible to
use (or modify) this plugin that it would save my images to different
folder, so the id of the model_id part would be id of the product that
the image belongs_to, not the id of the image?
30269682335f1fb247d71969fa715b5e?d=identicon&s=25 Roberto Saccon (rsaccon)
on 2006-03-06 11:16
(Received via mailing list)
On 3/6/06, g0nzo <g0nzo@o2.pl> wrote:
>
> Hi!
>
> File_column plugin saves uploaded files to
> "public/model/image/model_id/filename", if i understand it correctly.
> Does it mean that it creates new folder for every image?


yes, because your model_id's are unique, filenames can be duplicate

I have product (model) that has_many images (model). Is it possible to
> use (or modify) this plugin that it would save my images to different
> folder, so the id of the model_id part would be id of the product that
> the image belongs_to, not the id of the image?


no (same reason as answer above), but what you can do is to define a
different root directory for your files if using  file_column from
Subsversion trunc, if that helps ..

--
F639e0cdf2fa098b535d6ec766b2aee1?d=identicon&s=25 Szymon Nowak (g0nzo)
on 2006-03-06 11:24
Thanks.

I've found one more problem - i don't know to use many
file_column_fields in a single form, so i'll leave my own ugly (but
working) code for now :)
C941170ba5ca038b89b8407c83fb23c2?d=identicon&s=25 Berin Loritsch (Guest)
on 2006-03-06 15:00
(Received via mailing list)
g0nzo wrote:
> Hi!
>
> File_column plugin saves uploaded files to
> "public/model/image/model_id/filename", if i understand it correctly.
> Does it mean that it creates new folder for every image?
>
When you consider that the file_upload plugin allows you to save
multiple versions of the same file for each ID, that works.
> I have product (model) that has_many images (model). Is it possible to
> use (or modify) this plugin that it would save my images to different
> folder, so the id of the model_id part would be id of the product that
> the image belongs_to, not the id of the image?
>
Honestly, I started playing with the file_upload plugin and then
realized that I wanted my images stored in the database--not the
filesystem.  Main reason was because I wanted to make it easier to
distribute the app.  When you save the images to the filesystem, you
have to set up your web app in a SAN if you want to distribute the
images and such across many servers scalably.  In the database, you make
it an issue of scaling the database.  More ISPs have experience doing
that than setting up SANs for your application.

I found it wasn't hard to do, and if you are interested I'll share how I
did it (Rails 1.0, MySQL 5)
37a37f5d32abc7a73ff102f968e590b8?d=identicon&s=25 nina zhang (Guest)
on 2006-03-07 03:51
Berin Loritsch wrote:
g0nzo wrote:
Hi!

File_column plugin saves uploaded files to
"public/model/image/model_id/filename", if i understand it correctly.
Does it mean that it creates new folder for every image?
When you consider that the file_upload plugin allows you to save
multiple versions of the same file for each ID, that works.
I have product (model) that has_many images (model). Is it possible to
use (or modify) this plugin that it would save my images to different
folder, so the id of the model_id part would be id of the product that
the image belongs_to, not the id of the image?

Honestly, I started playing with the file_upload plugin and then
realized that I wanted my images stored in the database--not the
filesystem.  Main reason was because I wanted to make it easier to
distribute the app.  When you save the images to the filesystem, you
have to set up your web app in a SAN if you want to distribute the
images and such across many servers scalably.  In the database, you make
it an issue of scaling the database.  More ISPs have experience doing
that than setting up SANs for your application.

I found it wasn't hard to do, and if you are interested I'll share how I
did it (Rails 1.0, MySQL 5)

would you please show me how to do that? Thanks!
25fcf8525f217851f994dc4fe52d6fdd?d=identicon&s=25 Peter Woolcock (Guest)
on 2006-03-23 16:10
(Received via mailing list)
I'm also interested in this could you please send me the info.
On 6-Mar-06, at 9:51 PM, nina zhang wrote:

> use (or modify) this plugin that it would save my images to different
> it an issue of scaling the database.  More ISPs have experience doing
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails

Peter Woolcock
peter@cosmicfrontier.ca
This topic is locked and can not be replied to.