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.
Alexander A. (Guest)
on 2006-01-04 10:02
(Received via mailing list)
I use file_column and it works fine.
I tried to change the store_dir to a the path I want my files to be
stored and not the default.
I stored some images fine. But when I try to reach my images it seems
like file_column uses the model_name/attribute_name on the image and not
the store_dir I used. How can I change this ?
Thanks in advance

--
Alexander A.
Sebastian K. (Guest)
on 2006-01-04 19:12
(Received via mailing list)
On 1/4/06, Alexander A. <removed_email_address@domain.invalid> wrote:
> I use file_column and it works fine.
> I tried to change the store_dir to a the path I want my files to be
> stored and not the default.
> I stored some images fine. But when I try to reach my images it seems
> like file_column uses the model_name/attribute_name on the image and not
> the store_dir I used. How can I change this ?

this should work by setting the :store_dir option like this.

file_column :image, :store_dir => "/some/path/on/your/disc"

However, your e-mail sounds as if you've already been aware of this?

Hope this helps
Sebastian
Alexander A. (Guest)
on 2006-01-04 19:14
(Received via mailing list)
Yes I have set the :store_dir to where I want my images to be stored but
not as a full path.

Sebastian K. wrote:
> this should work by setting the :store_dir option like this.
> http://lists.rubyonrails.org/mailman/listinfo/rails
--
Alexander A.
Information Systems Department
Mediterranean Agronomic Institute of Chania
Tel.: +30 28210 35000 718
Email: removed_email_address@domain.invalid
Alexander A. (Guest)
on 2006-01-04 19:14
(Received via mailing list)
Sorry I sended the mail unfinished ...
Yes I have set the :store_dir to where I want my images. I tried with
the full path of the folder also but url_for_image_column always returns
the model_name/attribute_name (which is image/image in my case) and not
the actuall store image_path.

Sebastian K. wrote:
> this should work by setting the :store_dir option like this.
> http://lists.rubyonrails.org/mailman/listinfo/rails
--
Alexander A.
Information Systems Department
Mediterranean Agronomic Institute of Chania
Tel.: +30 28210 35000 718
Email: removed_email_address@domain.invalid
Sebastian K. (Guest)
on 2006-01-04 23:25
(Received via mailing list)
On 1/4/06, Alexander A. <removed_email_address@domain.invalid> wrote:
> Yes I have set the :store_dir to where I want my images. I tried with
> the full path of the folder also but url_for_image_column always returns
> the model_name/attribute_name (which is image/image in my case) and not
> the actuall store image_path.

ahh. Yes, url_for_file_column has no idea how to access the path you
gave to :store_dir via an URL. If you set the :base_url option to the
URL at which the directory in :store_dir can be reached,
url_for_file_column should work.

Sebastian
This topic is locked and can not be replied to.