Let's say you were trying to implement a SOPA enforcement tool:
class Blog < ActiveRecord::Base has_one :author ... scope :infringing, where("artist_mentions_count > 0") scope :main_competition, where("competition_rank > 7") scope :generally_disliked, where("subjective_dislike_rating > 3") ... end
This would let you write handy things like
to_blacklist = Blog.infringing.or.main_competition.or.generally_disliked to_harass = Blog.joins(:author).where('authors.name' => 'Julian')\ .or.generally_disliked
Gem extracted from (i.e. mostly sponsored by) http://www.hfa3.org/
Dispite the name of the gem, I'll probably add
not logic also. Seems
not are really all that's missing from AR scopes.