activestorage-validator
activestorage-validator copied to clipboard
Non-ActiveRecord object
I am using the validator in a form object class as follows:
class QuoteRequestForm
include ActiveModel::Model
include NullObject::Conversions
attr_accessor :name, :email, :time_zone, :file
validates :file, presence: true, blob: { content_type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }
end
However, the tests fail as follows:
ArgumentError:
Unknown validator: 'BlobValidator'
I think you need to include the ActiveRecord::Validations
Because the BlobValidator
class is defined inside that module.
Same issue here - that include doesn't work
It's difficult because activestorage is closely related to activerecord.