in misc

Rails ActiveStorage import on Mac OS X, missing files

Capistrano-db-tasks is a nice tool to pull production data to the local environment. This nicely imports all SQL data and imports the activestorage files from the /storage folders to the development environment.

When importing the active storage files, not all blob-files are imported. So you get missing file on your local machine. Which is not very desirable, certainly when you are working on a rails upgrade and want to test if everything is working.

I'm using a MacOS X development machine. By default OS X uses a case insensitive filesystem (APFS).

The production machine uses FreeBSD or Linux as OS. Which has a case sensitive filesystem.

ActiveStorage generate case sensitive filenames by default (Why!?!). So you can have a folder 'xE' and 'Xe', which are 2 different folders on BSD/Linux, but not on my Mac.

Today I configured a solution suggested by Brian Boyko: https://brianboyko.medium.com/a-case-sensitive-src-folder-for-mac-programmers-176cc82a3830

Mounting a case-sensitive container. '/Volumes/casesensitive'

Via disutility you can create a case-sensitive APFS container. This container shares the space of you main disk. But is case-sensitive.

I use this container to link my storage folders. (I don't have the need to have a case sensitive code directory) .
This is extra nice, because the gigantic storage files aren't stored in my projects folder anymore.

ln -s /Volumes/casesensitive/project/storage ~/project/storage