Categorized: Rails

Change the default folder for file_column to store images

Update 2006-12-31: I don’t think this is quite right. It keeps creating a folder in my Rails root as well as in public/. I think I might switch to acts_as_attachment anyway.

In your model, where you define the sizes and whatnot that you want, put:

file_column :database_column_name,
  :store_dir => 'path/you/want',
  :base_url => 'path/you/want',
  (the rest of your configuration)

So what you end up with is images going into rails_root/public/path/you/want/database_id_of_image/

Comments

Nothing to see here yet. Start things off, why don't you?

What do you think about that?

Elsewhere in the empire: Home, Blog, APOD