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 @@
+ + <% if flash[:error].present? %> +
<%= flash[:error] %>
+ <% end %>
<% end %> diff --git a/app/views/recruiter/form.html.erb b/app/views/recruiter/form.html.erb index e0b7029..24d9b48 100644 --- a/app/views/recruiter/form.html.erb +++ b/app/views/recruiter/form.html.erb @@ -4,9 +4,11 @@ <% if flash[:error].present? %>
<%= flash[:error] %> - <% @candidate.errors.messages.each do |k,v| %> -

<%= "#{k}: #{v}" %>

- <% end %> +

+ <% @candidate.errors.messages.each do |k,v| %> + <%= "#{k.to_s} #{v.join(' and ')}" %>
+ <% end %> +

<% end %> @@ -27,6 +29,6 @@ <%= form.hidden_field :quiz_id, { value: Quiz.first.to_i } %> - <%= submit_tag "Login" %> + <%= submit_tag "Save" %> <% end %>