Forum: Ruby on Rails file_column: changing default store_dir

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.
Jeff McDonald (Guest)
on 2006-02-20 04:32
(Received via mailing list)
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!
Jeff McDonald (Guest)
on 2006-02-21 00:57
(Received via mailing list)
Anyone know how to do this?
Simon King (Guest)
on 2006-05-21 16:36
(Received via mailing list)
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
This topic is locked and can not be replied to.