I have the following problem: I want to override the find_for_authentication method to not include users who have been soft-deleted (I'm using a deleted_at timestamp field to do this). The problem is, just merging the condition hash which is used by find_for_authentication with the new condition :deleted_at => nil generates a "bad" SQL syntax, namely adding a "AND deleted_at = ''" to the query, which is obviously not "NULL" and thus doesn't find the correct records.
Anyone who stumbled over the same problem? I could, of course, move all the logic which happens in the super class to my User class, but what I've seen from the sources, there's a lot of stuff hidden behind the base implementation.
super(conditions.merge(:deleted_at => nil))
# Yields a SQL query like SELECT "users".* FROM "users" WHERE "users"."email" = 'firstname.lastname@example.org' AND "users"."deleted_at" = 'IS NULL' LIMIT 1