diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index 3855b53..31e1ca8 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -45,7 +45,7 @@ class CandidateController < ApplicationController def validate candidate = Candidate.find_by(test_hash: params['test_id']) - redirect_to(root_path, alert: "Sorry, incorrect test id") and return if candidate.nil? + redirect_to(root_path, flash: { error: "Sorry, incorrect test id" }) and return if candidate.nil? session[:test_id] = candidate.test_hash redirect_to :thankyou and return if candidate.completed? diff --git a/app/validators/email_format_validator.rb b/app/validators/email_format_validator.rb index cc2ec71..a862eb8 100644 --- a/app/validators/email_format_validator.rb +++ b/app/validators/email_format_validator.rb @@ -10,7 +10,7 @@ class EmailFormatValidator < ActiveModel::EachValidator end if results.include?(false) - record.errors[attribute] << (options[:message] || "is not formatted properly: #{value}") + record.errors[attribute] << (options[:message] || "is not formatted properly") end end end diff --git a/app/views/candidate/welcome.html.erb b/app/views/candidate/welcome.html.erb index ae4fe34..dabca15 100644 --- a/app/views/candidate/welcome.html.erb +++ b/app/views/candidate/welcome.html.erb @@ -38,6 +38,10 @@
<%= "#{k}: #{v}" %>
- <% end %> +
+ <% @candidate.errors.messages.each do |k,v| %>
+ <%= "#{k.to_s} #{v.join(' and ')}" %>
+ <% end %>
+