Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Commit

Permalink
[FIX] Fixed errors in the "terms" facet on Ruby 1.8
Browse files Browse the repository at this point in the history
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
karmi committed Jul 25, 2012
1 parent 2dd08e0 commit 5129f8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tire/search/facet.rb
Expand Up @@ -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) }
Expand Down

0 comments on commit 5129f8a

Please sign in to comment.