SimpleCSVUploder 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/SimpleCSVUploder/version.rb +1 -1
- data/lib/SimpleCSVUploder.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be5e05e0244df32f95894d79718126090a24717e
|
4
|
+
data.tar.gz: 66319207c78d6b7481ffc9d0594efaae8051dfa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf57cb6862309be9fcc2786fdb17536638aed444baae4c889b84241d69ed82cb1f8a14e96aa42fa9f4645bf8c509d09c9c227bfc61bec12754418f5ef0860f5
|
7
|
+
data.tar.gz: 4dcff3a7025cdae6384386f2156a8763c7bec7aaa95dd64dbc45424fe4fbe34f9437ed2c2fa61d5c742c9ba97f9b65739dbec3ab3be98673da8bd6ba2712c406
|
data/lib/SimpleCSVUploder.rb
CHANGED
@@ -25,6 +25,12 @@ module SimpleCSVUploder
|
|
25
25
|
return File.basename(filename)
|
26
26
|
end
|
27
27
|
|
28
|
+
def check_duplication_filename
|
29
|
+
if Document.where(filename: self.filename).present?
|
30
|
+
errors.add(:file, 'File already exists.')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
def csv_file_format
|
29
35
|
if self.content_type != "text/csv"
|
30
36
|
errors.add(:file, 'File format should be only CSV.')
|