diff options
author | Starfall <us@starfall.systems> | 2022-01-31 12:50:14 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2022-01-31 12:50:14 -0600 |
commit | 17265f47f8f931e70699088dd8bd2a1c7b78112b (patch) | |
tree | a1dde2630cd8e481cc4c5d047c4af241a251def0 /lib/paperclip/schema_extensions.rb | |
parent | 129962006c2ebcd195561ac556887dc87d32081c (diff) | |
parent | d6f3261c6cb810ea4eb6f74b9ee62af0d94cbd52 (diff) |
Merge branch 'glitchsoc'
Diffstat (limited to 'lib/paperclip/schema_extensions.rb')
-rw-r--r-- | lib/paperclip/schema_extensions.rb | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/paperclip/schema_extensions.rb b/lib/paperclip/schema_extensions.rb deleted file mode 100644 index 8d065676a..000000000 --- a/lib/paperclip/schema_extensions.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -# Monkey-patch various Paperclip methods for Ruby 3.0 compatibility - -module Paperclip - module Schema - module StatementsExtensions - def add_attachment(table_name, *attachment_names) - raise ArgumentError, 'Please specify attachment name in your add_attachment call in your migration.' if attachment_names.empty? - - options = attachment_names.extract_options! - - attachment_names.each do |attachment_name| - COLUMNS.each_pair do |column_name, column_type| - column_options = options.merge(options[column_name.to_sym] || {}) - add_column(table_name, "#{attachment_name}_#{column_name}", column_type, **column_options) - end - end - end - end - - module TableDefinitionExtensions - def attachment(*attachment_names) - options = attachment_names.extract_options! - attachment_names.each do |attachment_name| - COLUMNS.each_pair do |column_name, column_type| - column_options = options.merge(options[column_name.to_sym] || {}) - column("#{attachment_name}_#{column_name}", column_type, **column_options) - end - end - end - end - end -end - -Paperclip::Schema::Statements.prepend(Paperclip::Schema::StatementsExtensions) -Paperclip::Schema::TableDefinition.prepend(Paperclip::Schema::TableDefinitionExtensions) |