Named_scope on has_many relationship

Hi,
I have three models: people, visit, place.
Each time a person visits a place, then a visit is created. I have the
relationships set up correctly with has_many through.

I want a simple way to find a list of all the visited (and also
not-visited) places. i.e. I want to be able to call something like
Places.visited
and
Places.not_visited

How can I do this? I thought I could do it with a named scope but then I
realized that there is nothing in the Places table to say if it has been
visited or not. The only record I have of a place being visited is a
row in the Visits table.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs