Make it Rails 4 compatible

I've relaxed activerecord and activesupport dependencies to >= 3.1 so it can run on Rails 4 apps.

Also, changed the way it creates a new temp table. id column is created automatically, so no need to explicity define it. It was throwing an error.

Tests are passing (with Rails 3.2.13) and I've tested it in a project with Rails 4 (beta1 and rc1) using postgre.