In the user table I have a name field, where some records are names, and some are emails. I know, bad approach. That aside. I'd like to write a named scope that returns only email records.
I've tried adapting a query that does this query, and failed.
MYSQL:
SELECT NAME
FROM USER
WHERE NAME LIKE '%@%.%'
User model:
scope :user_email, :conditions => ["name like '%@%.%'"]
Any help would be appreciated.