diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/registration.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/registration.rb b/lib/registration.rb index 16be55a..e38f0fe 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -21,6 +21,10 @@ def generate_pdf_for(band, filename) pdf.render(filename) end +def sanitize(s) + s.gsub(/[ ,.:!^'*\/\\]+/, '-') +end + def create_pdf_file_name(band) - filename = "#{Date.today.iso8601}-#{band.name}-#{band.city}.pdf" + filename = "#{Date.today.iso8601}-#{sanitize(band.name)}-#{sanitize(band.city)}.pdf" end |