Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[FIX] Fixed errors in the "terms" facet on Ruby 1.8

In Ruby 1.8.x:

    "hello".is_a?(Enumerable)
    # => true

    "hello".respond_to?(:each)
    # => true

Can be confusing, yeah. You should upgrade to 1.9 :)
  • Loading branch information...
commit 5129f8a52c7cf430babc15163193061848132c24 1 parent 2dd08e0
@karmi authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/tire/search/facet.rb
View
2  lib/tire/search/facet.rb
@@ -17,7 +17,7 @@ def initialize(name, options={}, &block)
def terms(field, options={})
size = options.delete(:size) || 10
all_terms = options.delete(:all_terms) || false
- @value = if field.is_a?(Enumerable)
+ @value = if field.is_a?(Enumerable) and not field.is_a?(String)
{ :terms => { :fields => field }.update({ :size => size, :all_terms => all_terms }).update(options) }
else
{ :terms => { :field => field }.update({ :size => size, :all_terms => all_terms }).update(options) }

0 comments on commit 5129f8a

Please sign in to comment.
Something went wrong with that request. Please try again.