Created
June 8, 2010 21:26
-
-
Save jackdempsey/430677 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# map/reduce conditions with meta_where and rails 3 | |
# syntax explanation at http://github.com/ernie/meta_where | |
scope :match, lambda { |term| where([:title,:description,:keywords].map{|col| col.matches % "%#{term}%"}.inject(&:|))} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment