All these years of using Rails, I had no idea has_one
did this.
More importantly with a relationship like follows,
class Model < ActiveRecord
has_one :build
end
class Build < ActiveRecord
has_one_attached_file :file
end
If I create_build
on Model
if one already exists, it will:
- Delete that
Build
, create a new one and attach it toModel
- Kickoff an
ActiveStorage::PurgeJob
and delete the file from GCS/AWS
This is highly uncomfortable.