Thanks for all of the answers.
I solved it a little differently and will explain how in case
a) it helps anybody else
b) there is a flaw in my method which I have overlooked

What I did was in the controller:
Create a model object: @applicant = Applicant.new(params[:applicant])
Wait for a post request.
Look up the last email address sucessfully stored in the database.
Check if it is the same as the email address currently being submitted?

If so, it is possible that someone has pressed submit twice, or used the 
back button in their browser. This can therefore be ignored and the user 
redirected to the success view.

If the email adresses are not identical, check if @applicant can be 
saved.
If it can, redirect to success, if it can't re render index view.

If the applicant is redirected to the success view without their data 
being saved (i.e. if both email addresses are the same), then they also 
receive a flash message that a double data entry was detected for their 
email address and that the record was only saved once.

For this particular application it is not desired that people can apply 
twice and in practice it rarely happens.


-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to