Assuming rails 3:
Company.contact_emails_id_not_null.select("distinct name_of_your_field")
If rails 2.3.x (please forgive me if this turns out to be false, I'm not sure)
Company.contact_emails_id_not_null.find(:all, :select => "distinct name_of_your_field")
name_of_your_field can also be * include all fields.
Let me know if this helps.
source
share