From 46db463d068d9b24c99f11a1c78dac1c1bfb45c2 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 5 Aug 2017 12:21:21 +0900 Subject: Fix ruby warnings This fixes following warnings: ``` test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized ``` --- activestorage/lib/active_storage/attached/macros.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'activestorage/lib/active_storage') diff --git a/activestorage/lib/active_storage/attached/macros.rb b/activestorage/lib/active_storage/attached/macros.rb index 89297e5bdf..f09f3e1f6d 100644 --- a/activestorage/lib/active_storage/attached/macros.rb +++ b/activestorage/lib/active_storage/attached/macros.rb @@ -22,8 +22,11 @@ module ActiveStorage::Attached::Macros # (i.e. destroyed) whenever the record is destroyed. def has_one_attached(name, dependent: :purge_later) define_method(name) do - instance_variable_get("@active_storage_attached_#{name}") || + if instance_variable_defined?("@active_storage_attached_#{name}") + instance_variable_get("@active_storage_attached_#{name}") + else instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::One.new(name, self)) + end end has_one :"#{name}_attachment", -> { where(name: name) }, class_name: "ActiveStorage::Attachment", as: :record @@ -60,8 +63,11 @@ module ActiveStorage::Attached::Macros # (i.e. destroyed) whenever the record is destroyed. def has_many_attached(name, dependent: :purge_later) define_method(name) do - instance_variable_get("@active_storage_attached_#{name}") || + if instance_variable_defined?("@active_storage_attached_#{name}") + instance_variable_get("@active_storage_attached_#{name}") + else instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::Many.new(name, self)) + end end has_many :"#{name}_attachments", -> { where(name: name) }, as: :record, class_name: "ActiveStorage::Attachment" -- cgit v1.2.3 From 10a7ae39c611b571719efcd1890b88d38017382c Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 5 Aug 2017 14:24:31 +0900 Subject: Change gem version of Active Storage to 5.2.0.alpha --- activestorage/lib/active_storage/gem_version.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activestorage/lib/active_storage') diff --git a/activestorage/lib/active_storage/gem_version.rb b/activestorage/lib/active_storage/gem_version.rb index cde112a006..db79c669bf 100644 --- a/activestorage/lib/active_storage/gem_version.rb +++ b/activestorage/lib/active_storage/gem_version.rb @@ -5,8 +5,8 @@ module ActiveStorage end module VERSION - MAJOR = 0 - MINOR = 1 + MAJOR = 5 + MINOR = 2 TINY = 0 PRE = "alpha" -- cgit v1.2.3 From 2b9e04b6f9b21087a8b44c4b3758d0b3ae1e7e12 Mon Sep 17 00:00:00 2001 From: dixpac Date: Thu, 3 Aug 2017 12:34:20 +0200 Subject: Remove unecesarry exception variable --- activestorage/lib/active_storage/service/azure_storage_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activestorage/lib/active_storage') diff --git a/activestorage/lib/active_storage/service/azure_storage_service.rb b/activestorage/lib/active_storage/service/azure_storage_service.rb index 527dc57eeb..e13b32eb98 100644 --- a/activestorage/lib/active_storage/service/azure_storage_service.rb +++ b/activestorage/lib/active_storage/service/azure_storage_service.rb @@ -19,7 +19,7 @@ class ActiveStorage::Service::AzureStorageService < ActiveStorage::Service instrument :upload, key, checksum: checksum do begin blobs.create_block_blob(container, key, io, content_md5: checksum) - rescue Azure::Core::Http::HTTPError => e + rescue Azure::Core::Http::HTTPError raise ActiveStorage::IntegrityError end end -- cgit v1.2.3 From 1ab1f8759607cae037522717594c02b6c7a7b168 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Fri, 4 Aug 2017 22:32:34 -0400 Subject: Check for `app.secrets.secret_key_base`, not `app.config.secret_key_base` By default, apps only have the former set. --- activestorage/lib/active_storage/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activestorage/lib/active_storage') diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index 1d345920fa..da83d3908a 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -27,7 +27,7 @@ module ActiveStorage initializer "active_storage.verifier" do config.after_initialize do |app| - if app.config.secret_key_base.present? + if app.secrets.secret_key_base.present? ActiveStorage.verifier = app.message_verifier("ActiveStorage") end end -- cgit v1.2.3