UsersEmail.find(:all, :conditions => ["email = 'firstname.lastname@example.org' "])
Returns me an array of all users_emails rows which have email
The problem is I need to also need to do a select based on users.name.
Fred suggested doing a :join using with the syntax ":join =>
But the following did not work. When I look at the SQL rails tried to
generate, it did not seem to do the join.
User.find(:all, :conditions => ["name = 'joe' and email =
'email@example.com"], :joins => :users_emails]
The actual error I get is "ActiveRedocrd::StatementInvalid:
Mysql::Error: #42S22Unknown column 'email' in 'whre clause': SELECT *
FROM users users_emails WHERE users_emails (email = 'joe')
Any help would be greatly appreciated.