From 398bb8eeb813e91e766691295d9f853fc460db3d Mon Sep 17 00:00:00 2001 From: Sean Marcia Date: Fri, 7 Sep 2018 21:17:52 -0400 Subject: [PATCH 1/2] Fallback to stock logo if org doesn't have one If the organization doesn't upload a logo, we should at least show some picture in it's place. This uses the stock diaperbase logo, which will show up on the org's homepage and pdf reports. --- app/models/organization.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 750929f0fd..cd71dba799 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -98,7 +98,11 @@ def self.seed_items(org) end def logo_path - Organization::DIAPER_APP_LOGO.to_s + if logo.attached? + ActiveStorage::Blob.service.send(:path_for, logo.key).to_s + else + Organization::DIAPER_APP_LOGO.to_s + end end private From 1383592ece26e769c8fad4737e5b1dbb085797a3 Mon Sep 17 00:00:00 2001 From: Keith Walters Date: Sat, 15 Sep 2018 14:36:14 -0400 Subject: [PATCH 2/2] Add storage to be auto-linked by capistrano Active Storage is configured to store uploads under the `storage/` path in `Rails.root`. This folder needs to be symlinked from the capistrano `shared/` path so that way the same uploads can persist between deployments. --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 74022525e9..8a1e488de1 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -33,7 +33,7 @@ ## Linked Files & Directories (Default None): set :linked_files, %w{config/database.yml} -set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} +set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system storage} namespace :puma do desc "Create Directories for Puma Pids and Socket"