Sha256: 4ec318e2e406a8eb4684bedd0c55666fd3972f035fc09af369bd1055cde0f71b
Contents?: true
Size: 479 Bytes
Versions: 2
Compression:
Stored size: 479 Bytes
Contents
module ImportableAttachments # :nodoc: # validate attachment is an excel file class ExcelValidator < ActiveModel::Validator # :call-seq: # validate :record # # ensures that the record's attachment file name has a .xls extension def validate(record) extension = record.attachment.io_stream_file_name.split('.').last if extension != 'xls' record.errors[:attachment] << 'File must be an Excel (.xls) file' end end end end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
importable_attachments-0.0.13 | app/validators/importable_attachments/excel.rb |
importable_attachments-0.0.13 | app/validators/importable_attachments/excel_validator.rb |