mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-15 00:24:09 +01:00
12 lines
415 B
Ruby
12 lines
415 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Validates uploaded images to check that it matches the env parameters
|
|
# You must `include ImageValidatorConcern` in your class to use it
|
|
module ImageValidatorConcern
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
validates :attachment, file_size: { maximum: Rails.application.secrets.max_image_size ? Rails.application.secrets.max_image_size.to_i : 2.megabytes.to_i }
|
|
end
|
|
end
|