- MODEL -
class Document < ActiveRecord::Base
has_one :user, :class_name => "User", :foreign_key => "fkey", :conditions => "user = 'NAME'"
- GENERATED SQL (per the .log) -
SELECT FIRST 1 * FROM table_name WHERE (table_name.fkey IS NULL AND
(user_id = ‘NAME’))
What I can’t figure out is what the “IS NULL” is doing inside the SQL.