Add CarrierWave Backgrounder
This commit is contained in:
parent
5c0871f33c
commit
d185c54f03
1
Gemfile
1
Gemfile
|
@ -38,6 +38,7 @@ gem 'tiny-color-rails'
|
|||
gem 'jquery-minicolors-rails'
|
||||
gem 'colorize'
|
||||
gem 'carrierwave', '~> 2.0'
|
||||
gem 'carrierwave_backgrounder', git: 'https://github.com/mltnhm/carrierwave_backgrounder.git'
|
||||
gem 'mini_magick'
|
||||
|
||||
gem "rolify", "~> 5.2"
|
||||
|
|
|
@ -10,6 +10,14 @@ GIT
|
|||
oauth
|
||||
simple_oauth
|
||||
|
||||
GIT
|
||||
remote: https://github.com/mltnhm/carrierwave_backgrounder.git
|
||||
revision: 8fe468957f047ad7039f07679e5952a534d07b6d
|
||||
specs:
|
||||
carrierwave_backgrounder (0.4.2)
|
||||
carrierwave (>= 0.5, <= 2.1)
|
||||
mime-types (>= 3.0.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/retrospring/questiongenerator.git
|
||||
revision: c5f8362ff769425d42a94b3a611731eadaa5e0ca
|
||||
|
@ -527,6 +535,7 @@ DEPENDENCIES
|
|||
byebug
|
||||
capybara
|
||||
carrierwave (~> 2.0)
|
||||
carrierwave_backgrounder!
|
||||
coffee-rails (~> 4.1)
|
||||
colorize
|
||||
database_cleaner
|
||||
|
|
|
@ -58,7 +58,9 @@ class User < ApplicationRecord
|
|||
validates :bio, length: { maximum: 200 }
|
||||
|
||||
mount_uploader :profile_picture, ProfilePictureUploader, mount_on: :profile_picture_file_name
|
||||
process_in_background :profile_picture
|
||||
mount_uploader :profile_header, ProfileHeaderUploader, mount_on: :profile_header_file_name
|
||||
process_in_background :profile_header
|
||||
|
||||
before_save do
|
||||
self.website = if website.match %r{\Ahttps?://}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class BaseUploader < CarrierWave::Uploader::Base
|
||||
include CarrierWave::Compatibility::Paperclip
|
||||
include CarrierWave::MiniMagick
|
||||
include CarrierWave::Backgrounder::Delay
|
||||
|
||||
storage :fog
|
||||
|
||||
|
|
|
@ -10,3 +10,7 @@ CarrierWave.configure do |config|
|
|||
config.fog_directory = APP_CONFIG.dig("fog", "directory") unless APP_CONFIG.dig("fog", "directory").nil?
|
||||
end
|
||||
end
|
||||
|
||||
CarrierWave::Backgrounder.configure do |c|
|
||||
c.backend :sidekiq, queue: :carrierwave
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ production:
|
|||
:concurrency: 25
|
||||
:queues:
|
||||
- share
|
||||
- paperclip
|
||||
- carrierwave
|
||||
- mailers
|
||||
- deletion
|
||||
- question
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_05_13_154602) do
|
||||
ActiveRecord::Schema.define(version: 2020_05_09_094402) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -250,7 +250,7 @@ ActiveRecord::Schema.define(version: 2020_05_13_154602) do
|
|||
t.text "bio", default: "", null: false
|
||||
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"
|
||||
t.boolean "profile_picture_processing"
|
||||
t.integer "crop_x"
|
||||
|
@ -267,7 +267,7 @@ ActiveRecord::Schema.define(version: 2020_05_13_154602) do
|
|||
t.integer "comment_smiled_count", default: 0, null: false
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue