ruby on rails 3 - Carrierwave dynamic storage type via model attributes -
i want save photographs in 'grid_fs' , other types of files 'fog', like:
class documentuploader < carrierwave::uploader::base def storage if model.is_photograph == true :grid_fs else :fog end end end
is possible?
i want dynamically assign storage type model attributes, , i've tried this, model , attributes not accessible in class method.
thanks!
the quick answer "no". unlike store_dir
, validate_integrity
et al, storage isn't sent through add_config
, , doesn't of instance-level magic make easy.
it might possible, come fragile hack. you're better off looking @ other ways support feature (multiple uploaders?) or changing specification.
Comments
Post a Comment