Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Yaroslav agreed to hand over the gem name ❤️
- Loading branch information
Showing
38 changed files
with
173 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module ActiveStorage::Attached::Macros | ||
def has_one_attached(name, dependent: :purge_later) | ||
define_method(name) do | ||
instance_variable_get("@active_storage_attached_#{name}") || | ||
instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::One.new(name, self)) | ||
end | ||
|
||
if dependent == :purge_later | ||
before_destroy { public_send(name).purge_later } | ||
end | ||
end | ||
|
||
def has_many_attached(name, dependent: :purge_later) | ||
define_method(name) do | ||
instance_variable_get("@active_storage_attached_#{name}") || | ||
instance_variable_set("@active_storage_attached_#{name}", ActiveStorage::Attached::Many.new(name, self)) | ||
end | ||
|
||
if dependent == :purge_later | ||
before_destroy { public_send(name).purge_later } | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/active_vault/attached/many.rb → lib/active_storage/attached/many.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
lib/active_vault/attached/one.rb → lib/active_storage/attached/one.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
lib/active_vault/config/sites.yml → lib/active_storage/config/sites.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class ActiveVault::Filename | ||
class ActiveStorage::Filename | ||
include Comparable | ||
|
||
def initialize(filename) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/active_vault/purge_job.rb → lib/active_storage/purge_job.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "rails/railtie" | ||
|
||
module ActiveStorage | ||
class Railtie < Rails::Railtie # :nodoc: | ||
config.active_storage = ActiveSupport::OrderedOptions.new | ||
|
||
config.eager_load_namespaces << ActiveStorage | ||
|
||
initializer "active_storage.routes" do | ||
require "active_storage/disk_controller" | ||
|
||
config.after_initialize do |app| | ||
app.routes.prepend do | ||
get "/rails/blobs/:encoded_key" => "active_storage/disk#show", as: :rails_disk_blob | ||
end | ||
end | ||
end | ||
|
||
initializer "active_storage.attached" do | ||
require "active_storage/attached" | ||
|
||
ActiveSupport.on_load(:active_record) do | ||
extend ActiveStorage::Attached::Macros | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/active_vault/site/gcs_site.rb → lib/active_storage/site/gcs_site.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/active_vault/site/mirror_site.rb → lib/active_storage/site/mirror_site.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/active_vault/site/s3_site.rb → lib/active_storage/site/s3_site.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ive_vault/verified_key_with_expiration.rb → ...e_storage/verified_key_with_expiration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.