File_column: changing default store_dir


#1

File_column plugin is great. I need to change the default :store_dir
from the dynamic “model_name/attribute_name” to an equally dynamic
“client_id/app_id/model_name/attribute_name”. In my model I have:

class Component < ActiveRecord::Base
belongs_to :component_type
belongs_to :component_group
breakpoint
file_column :content,
:magick => { :versions => { “thumb” => “100x100”,
“medium” => “640x480>” }},
:store_dir =>
“#{client_id}/#{app_id}/#{model_name}/#{attribute_name}”
end

How can I get the 4 dynamic variables that I need into the model ‘the
ruby/rails way’? client_id and app_id are determined by the user’s
log in and could be stored in the session or passed in somehow.

Thanks!


#2

Anyone know how to do this?


#3

Hi Jeff

Did you figure out a way to pass variables as file_column options? I
have a similar problem where I’m trying to pass settings based on the
logged in user’s properties.

Thank you,
Simon