Skip to content

Commit

Permalink
Service-name do blob do active: storage funcionando. Erro de vip42 no…
Browse files Browse the repository at this point in the history
… active storage. Ver: libvips/ruby-vips#284 (comment)
  • Loading branch information
MarioCesarBais committed Jan 20, 2023
1 parent 288e4fc commit ce34f47
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 3 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -56,6 +56,7 @@ gem "simple_form", github: "heartcombo/simple_form"
gem "pundit"
gem 'gravatar_image_tag'
gem 'erb_lint' # marketplace est linter
gem 'image_processing', '~> 1.2'
# gem 'turbolinks' # , '~> 2.5', '>= 2.5.3' # https://rubygems.org/gems/turbolinks/versions/2.5.3?locale=pt-BR

group :development, :test do
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Expand Up @@ -135,6 +135,9 @@ GEM
gravatar_image_tag (1.2.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.6.0)
irb (1.6.2)
reline (>= 0.3.0)
Expand All @@ -155,6 +158,7 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mini_magick (4.12.0)
mini_mime (1.1.2)
minitest (5.17.0)
msgpack (1.6.0)
Expand Down Expand Up @@ -232,6 +236,8 @@ GEM
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
rubyzip (2.3.2)
sassc (2.4.0)
ffi (~> 1.9)
Expand Down Expand Up @@ -298,6 +304,7 @@ DEPENDENCIES
erb_lint
font-awesome-sass (~> 6.1)
gravatar_image_tag
image_processing (~> 1.2)
jbuilder
jsbundling-rails
pg (~> 1.1)
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/_banner.scss
Expand Up @@ -4,7 +4,7 @@
padding-top: 100px;
padding-bottom: 200px;
height: 7vh;
background-image: url(https://media.istockphoto.com/photos/thetahealing-concept-meditation-in-process-two-women-having-calm-down-picture-id1204889002?b=1&k=20&m=1204889002&s=170667a&w=0&h=WLeYhojqqVx0z9VdxIRUwCOEgbULFzmT1j_h1oBdLXA=);
background-image: url("istockphoto-1204889002-170667a.jpg");
color: #eee;
text-align: center;
}
Expand Down
@@ -0,0 +1,22 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)

unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string

if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end

change_column :active_storage_blobs, :service_name, :string, null: false
end
end

def down
return unless table_exists?(:active_storage_blobs)

remove_column :active_storage_blobs, :service_name
end
end
@@ -0,0 +1,27 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)

# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
t.string :variation_digest, null: false

t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end

private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end

def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end
@@ -0,0 +1,8 @@
# This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)

change_column_null(:active_storage_blobs, :checksum, true)
end
end
12 changes: 10 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce34f47

Please sign in to comment.