I have a similar problem that I'm working on, but I was going to take a slightly different approach.
My problem is that I'm collecting completely anonymous data at first, but then I want people to be able to come in later and create an account, then hopefully be able to find their records. I'm not sure if this scenario is even realistic, but here is where I am at in my thinking so far… The user enters the initial data and their IP address is stored along with it (could this be my main downfall? I need to do more research on how these work and if they are truly unique for each user). When they come back (hopefully on the same computer!) and either try to enter the data again or go straight to making an account, I want to find a matching IP and validate that they are a returning user from the Model… then basically ask them if they've been here before, if so yada yada yada… This is still turning around in my brain and I have yet to do any research on it…but if anyone see's any flaws in this method, feel free to let me know. Jim - it seems that if you can do your validation in the Model that would be better practice, but I'm not sure if that suits your needs. On Aug 27, 2:29 am, Jim Burgess <[email protected]> wrote: > 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 viahttp://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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

