Making Devise play nicely with Postgres (case sensitivity)

Devise, in case you haven’t used it, is a wonderful authentication solution for Rails. It’s essentially a Rails engine that handles authentication for you.

However, one speed bump that I encountered in paradise is that, when used with Postgres, the password reset and and login mechanisms can have issues. The problem is a simple one: Postgres is case-sensitive.

The solution is just a couple of minor tweaks. Add the below to your user (or whatever you call it) ActiveRecord model and all will be well.

Update: This appears to be fixed, at least in part or in total, in the current 1.2 release candidate.

Posted by evan on Friday, December 03, 2010

blog comments powered by Disqus