For purposes of maintenance and data cleanup, sometimes it is helpful to 
determine if you have orphaned records in your AR backing store.

Assuming that an AR::Base descendant has one or more belongs_to 
associations, I propose the addition of built-in 
"<association_name>_orphaned" scopes that would return the set of records 
where the belongs_to association record doesn't exist. Using association 
introspection, this would be fairly straightforward.

However, I'm not certain about the idea of having a "built-in" scope, as 
I'm not sure if any even exist at this point. Is this better implemented in 
a standalone gem that would then add these scopes?

Many thanks,
Wes

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to