Archive image

Archive for September, 2013

Prevent double data submission in Rails 3

I was recently working on an application, that lets people from all over the world apply for a programme at the university I work at.

The application works well and does what it should, but we were seeing quite a lot of double submissions, that is to say, the same person applying multiple times in short succession.

Here’s how I fixed that.

Read more…

Custom routes with resources in rails 3

The problem: you have a RESTful resource with default routes. The form to create a new item is located at http://mydomain.com/resource/new/. When you submit the form with valid input, a new itemĀ is created and that works fine.

However, when you submit the form with invalid input, the controller re-renders the form and the URL is changed to http://mydomain.com/resource. This is potentially confusing for end users.

How can we avoid this?

Read more…