From 67d6a82610ffed0afaab0cab145024b29e00258c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 5 Oct 2015 21:46:42 +0200 Subject: Switch to use session to send errors back to form. --- registration.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'registration.rb') diff --git a/registration.rb b/registration.rb index c6598d1..0f1ac34 100644 --- a/registration.rb +++ b/registration.rb @@ -6,9 +6,10 @@ class RegistrationApp < Sinatra::Base helpers Sinatra::UrlForHelper include ERB::Util + enable :sessions + get '/' do - @errors = request['errors'] - @errors = @errors.split('|') if @errors + @errors = session['errors'] erb :index end @@ -21,7 +22,8 @@ class RegistrationApp < Sinatra::Base send_registration_emails_for @band erb :submitted else - redirect to(url_for('/', :errors => @band.errors.join('|'))) + session['errors'] = @band.errors + redirect to('/') end end end -- cgit v1.2.3