summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-10-05 21:46:42 +0200
committerHarald Eilertsen <haraldei@anduin.net>2015-10-05 21:46:42 +0200
commit67d6a82610ffed0afaab0cab145024b29e00258c (patch)
tree43e0c0d4227321c1e54bd06837c1bb8f158954b5
parent01987cc0b88fdb0748d8d71cca4f5e40ea8a2604 (diff)
downloadnorsk-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.rb8
-rw-r--r--spec/registration_spec.rb1
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