I am using Postgres and have the (working) SQL as something like:
SELECT 
distinct(users.id),
users.*
FROM 
public.addons, 
public.containers, 
public.users
WHERE 
( (addons."value" = 'Something' AND addons."name" = 'bob') OR
addons."value" = 'Something else' AND addons."name" = 'bill') AND 
(containers.id = addons.site_id AND 
users.id = containers.user_id)
What I want to do is format this so that it returns a set of user objects. I am not sure how I format this so that its something like (not working):
@users = User.find(:include => [:users, :containers, :addons], :conditions => {( (addons."value" = 'Something' AND addons."name" = 'bob') OR
    addons."value" = 'Something else' AND addons."name" = 'bill') AND 
    (containers.id = addons.site_id AND 
    users.id = containers.user_id) } )
Is this even possible?
 
     
     
    