I've got a single table inheritance structure in my application whereby Admins and Mods extends a User class. The table uses a discriminator value so each record has a type of either "admin" or "mod"
When it comes to finding a user (on login) I'd like to write the following:
current_user = User.find(params[:email => email])
However, this creates SQL which includes
SELECT ...... WHERE ("type" IN ('User') AND .....
This means that the record cannot be found. However if I type
current_user = Admin.find(params[:email => email])
I get the user (if they are an admin).
I've also tried the following to no avail since the 'type' IN ('User') is still created:
current_user = User.first(:email => email, :type => [Admin, Mod])
Thanks in advance for any help on this