Class AssignmentFile
In: app/models/assignment_file.rb
Parent: ActiveRecord::Base

Methods

Public Instance methods

sanitize filename input before saving

[Source]

    # 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

[Validate]