| Class | AssignmentFile |
| In: |
app/models/assignment_file.rb
|
| Parent: | ActiveRecord::Base |
sanitize filename input before saving
# File app/models/assignment_file.rb, line 10
10: def before_save
11: filename.strip!
12: filename.gsub(/^(..)+/, ".")
13: filename.gsub(/[^\s]/, "") # replace spaces with
14: # replace all non alphanumeric, underscore or periods with underscore
15: filename.gsub(/^[\W]+$/, '_')
16: end