lib/SimpleCSVUploder.rb in SimpleCSVUploder-0.1.2 vs lib/SimpleCSVUploder.rb in SimpleCSVUploder-0.1.3

- old
+ new

@@ -23,9 +23,15 @@ def sanitize_filename(filename) return File.basename(filename) end + def check_duplication_filename + if Document.where(filename: self.filename).present? + errors.add(:file, 'File already exists.') + end + end + def csv_file_format if self.content_type != "text/csv" errors.add(:file, 'File format should be only CSV.') end end