Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add readme and project description

  • Loading branch information...
commit 916ee1927ed222810a8c21cc6df8365048faf179 1 parent 4b61f1c
@woahdae authored
Showing with 34 additions and 2 deletions.
  1. +32 −0 README.md
  2. +2 −2 active_record_or.gemspec
View
32 README.md
@@ -0,0 +1,32 @@
+ActiveRecord OR
+===============
+
+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
+
+The end.
+
+Credits
+=======
+
+Gem extracted from (i.e. mostly sponsored by) http://www.hfa3.org/
+
+TODO
+====
+
+Dispite the name of the gem, I'll probably add `not` logic also. Seems
+like `or` and `not` are really all that's missing from AR scopes.
View
4 active_record_or.gemspec
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
s.authors = ["Woody Peterson"]
s.email = ["woody.peterson@gmail.com"]
s.homepage = ""
- s.summary = %q{TODO: Write a gem summary}
- s.description = %q{TODO: Write a gem description}
+ s.summary = %q{Chain scopes with 'or'}
+ s.description = %q{Adds OR logic to ActiveRecord}
s.rubyforge_project = "active_record_or"
Please sign in to comment.
Something went wrong with that request. Please try again.