diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2015-10-05 21:46:42 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2015-10-05 21:46:42 +0200 |
commit | 67d6a82610ffed0afaab0cab145024b29e00258c (patch) | |
tree | 43e0c0d4227321c1e54bd06837c1bb8f158954b5 | |
parent | 01987cc0b88fdb0748d8d71cca4f5e40ea8a2604 (diff) | |
download | norsk-urskog-registrations-67d6a82610ffed0afaab0cab145024b29e00258c.tar.gz norsk-urskog-registrations-67d6a82610ffed0afaab0cab145024b29e00258c.tar.bz2 norsk-urskog-registrations-67d6a82610ffed0afaab0cab145024b29e00258c.zip |
Switch to use session to send errors back to form.
-rw-r--r-- | registration.rb | 8 | ||||
-rw-r--r-- | spec/registration_spec.rb | 1 |
2 files changed, 6 insertions, 3 deletions
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 diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index 3d7deed..d76d59e 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -1,4 +1,5 @@ require "prawn" +require 'rack/session/cookie' describe RegistrationApp do include Rack::Test::Methods |