aboutsummaryrefslogtreecommitdiffstats
path: root/app/uploaders
diff options
context:
space:
mode:
authorZog2018-03-13 09:10:34 +0100
committerJohan Van Ryseghem2018-04-04 11:08:20 +0200
commitf946eb8d72a5601020c420b33225c31b12277be4 (patch)
treeb4d2287a6f72b6d2d34c15a0076d2fe79d3c6312 /app/uploaders
parentecf0dd6406576f8a63ee056fab73b05171c3e767 (diff)
downloadchouette-core-f946eb8d72a5601020c420b33225c31b12277be4.tar.bz2
Refs #6089; Adds `attachment` Custom Fields
As well as an helper to render them in a partial
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/custom_field_attachment_uploader.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/uploaders/custom_field_attachment_uploader.rb b/app/uploaders/custom_field_attachment_uploader.rb
new file mode 100644
index 000000000..411b65bc3
--- /dev/null
+++ b/app/uploaders/custom_field_attachment_uploader.rb
@@ -0,0 +1,12 @@
+class CustomFieldAttachmentUploader < CarrierWave::Uploader::Base
+
+ storage :file
+
+ def store_dir
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ def extension_whitelist
+ model.send "#{mounted_as}_extension_whitelist"
+ end
+end