ruby - Change temporary directory in Rails 4 -


i looking change temporary directory in rails 4. default "#{rails.root}/tmp" change else, e.g.: "/tmp".

i have found how change cache directories "#{rails.root}/tmp":

config.cache_store = :file_store, '...' config.assets.cache_store = :file_store, '...' 

sprockets seems still using default tmp directory caching.

in rails 3 project, added following in config/application.rb:

if env['rails_tmp'].present?   config.cache_store = :file_store, env['rails_tmp'] + '/cache/'   config.assets.cache_store = :file_store, env['rails_tmp'] + '/assets'   config.sass.cache = false end 

setting rails_tmp causes tmp dir change. have odd feeling hard coded.

it seems libraries hard code values... see: [1]

by adding following can around hard coded value:

  config.assets.cache_limit = 50.megabytes    config.assets.configure |env|     env.cache = sprockets::cache::filestore.new(         file.join(env['rails_tmp'], 'cache/assets'),         config.assets.cache_limit,         env.logger     )   end 

Comments