Sorry, I am still a little green with Ruby on Rails to say the least so I'd appreciate even being guided in the same direction.
So... I have three DB tables, let's call them people, jobs and hats. I have a scope that returns only people that do certain jobs:
named_scope :emergency_workers, :include => :job, :conditions => {'jobs.name' => 'Police', 'jobs.name' => 'Fire','jobs.name' => 'paramedic'}
I have a scope that returns only people that wear a hat:
named_scope :hat_wearers, :include => :job, :joins => :hat, :conditions => ["hats.name IS NOT ?", nil]
My question is, how do I define a scope that says "show me only people that wear a hat (as above) unless they do this particular job, say farmer". So, my code would return all the hat wearers and all the farmers.
Not sure if that makes even a lick of sense but I'd be very grateful for guidance...