Permalink
Browse files

Ensuring Rails treats ThinkingSphinx::Search instances as arrays.

  • Loading branch information...
1 parent 15f65e0 commit f0e9ab71dca3886bda9a216038768c47bf41f791 @pat pat committed Sep 4, 2009
Showing with 17 additions and 0 deletions.
  1. +1 −0 lib/thinking_sphinx.rb
  2. +7 −0 lib/thinking_sphinx/core/array.rb
  3. +9 −0 spec/lib/thinking_sphinx/core/array_spec.rb
View
@@ -7,6 +7,7 @@
require 'after_commit'
require 'yaml'
+require 'thinking_sphinx/core/array'
require 'thinking_sphinx/core/string'
require 'thinking_sphinx/property'
require 'thinking_sphinx/active_record'
@@ -0,0 +1,7 @@
+module SearchAsArray
+ def ===(object)
+ object.is_a?(ThinkingSphinx::Search) || super
+ end
+end
+
+Array.extend SearchAsArray
@@ -0,0 +1,9 @@
+require 'spec/spec_helper'
+
+describe Array do
+ describe '.===' do
+ it "should return true if an instance of ThinkingSphinx::Search" do
+ Array.should === ThinkingSphinx::Search.new
+ end
+ end
+end

0 comments on commit f0e9ab7

Please sign in to comment.