From 5c0871f33ca757f44acd0b9742ead07f705f49a6 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Wed, 6 May 2020 16:13:44 +0100 Subject: [PATCH] Address @nilsding's review comments - Fix types on legacy attachment migrations - Restore Action Mailer setup for development env - Use `Hash#dig` in CarrierWave initializer --- config/environments/development.rb | 10 ++++++++-- config/initializers/25_carrierwave.rb | 4 ++-- ...29085904_add_attachment_profile_picture_to_users.rb | 2 +- ...508144336_add_attachment_profile_header_to_users.rb | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index 7f2cc1de..cd66aa46 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -29,8 +29,14 @@ Rails.application.configure do # Action Mailer Setup # if you want to test sending mails locally, uncomment the line below and comment the :sendmail line # config.action_mailer.delivery_method = :letter_opener - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } + if ENV["mailcatcher"] == "yes" + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } + elsif ENV["letteropener"] == "yes" + config.action_mailer.delivery_method = :letter_opener + else + config.action_mailer.delivery_method = :sendmail + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false diff --git a/config/initializers/25_carrierwave.rb b/config/initializers/25_carrierwave.rb index 422b791a..754abd4e 100644 --- a/config/initializers/25_carrierwave.rb +++ b/config/initializers/25_carrierwave.rb @@ -6,7 +6,7 @@ CarrierWave.configure do |config| config.fog_directory = "/system" unless APP_CONFIG["fog"].nil? - config.fog_credentials = APP_CONFIG["fog"]["credentials"] unless APP_CONFIG["fog"]["credentials"].nil? - config.fog_directory = APP_CONFIG["fog"]["directory"] unless APP_CONFIG["fog"]["directory"].nil? + config.fog_credentials = APP_CONFIG.dig("fog", "credentials") unless APP_CONFIG.dig("fog", "credentials").nil? + config.fog_directory = APP_CONFIG.dig("fog", "directory") unless APP_CONFIG.dig("fog", "directory").nil? end end \ No newline at end of file diff --git a/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb b/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb index 5826b09a..ff05535d 100644 --- a/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb +++ b/db/migrate/20141229085904_add_attachment_profile_picture_to_users.rb @@ -3,7 +3,7 @@ class AddAttachmentProfilePictureToUsers < ActiveRecord::Migration[4.2] change_table :users do |t| t.string :profile_picture_file_name t.string :profile_picture_content_type - t.bigint :profile_picture_file_size + t.integer :profile_picture_file_size t.datetime :profile_picture_updated_at end end diff --git a/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb b/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb index 91ac267c..fabf823d 100644 --- a/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb +++ b/db/migrate/20150508144336_add_attachment_profile_header_to_users.rb @@ -3,7 +3,7 @@ class AddAttachmentProfileHeaderToUsers < ActiveRecord::Migration[4.2] change_table :users do |t| t.string :profile_header_file_name t.string :profile_header_content_type - t.bigint :profile_header_file_size + t.integer :profile_header_file_size t.datetime :profile_header_updated_at t.boolean :profile_header_processing t.integer :crop_h_x