How to Properly Manage The Rails Tmp Directory

Can the rails tmp/cache/assets files be safely deleted?

Yep! You can delete the whole tmp directory and it will get recreated.

Why are RackMultipart* files persisting in my Rails /tmp directory?

I don't know if this is anymore elegant but this is what I am doing after the file is saved"

tempfile = params[:file].tempfile.path
if File::exists?(tempfile)
File::delete(tempfile)
end

What is a right way to deal with tests, temporary files and version control

The files required when the tests start should be in source control. Ideally you want temp files created by tests to be in one directory so you can ignore the whole directory. If that's not possible then add each file to the .gitignore file. Really, outside of test results, your specs should clean up after themselves, which should include deleting temp files created during testing.

I cannot get git to ignore my tmp folder of my Ruby on Rails project

The obvious one being . How do I get this to work?

Add /tmp to your .gitignore at the root of your Rails app. Make sure you add and commit this .gitignore before committing /tmp — you'd have to git rm it to make it disappear from the repository again.

Is it possible for me to run my ruby on rails applications without the tmp folder?

No. Why would you? Rails needs to be able to write files there in order to work properly. You can only symlink it somewhere else, but that won't really solve the issue if the files are included in your repository. See also: Rails3: Change location of temp (tmp) directory



Related Topics



Leave a reply



Submit