has_searcher 0.0.4.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,20 +44,20 @@ class Search < ActiveRecord::Base
44
44
  end
45
45
 
46
46
  def normalize(column)
47
- if column != "term" && respond_to?("normalize_#{column}")
47
+ if respond_to?("normalize_#{column}")
48
48
  send "normalize_#{column}"
49
49
  elsif self.class.serialized_attributes[column] == Array
50
50
  [*self.send("#{column}_before_type_cast")].select(&:present?)
51
51
  elsif column_for_attribute(column).type == :integer
52
52
  self[column].try(:zero?) ? nil : self[column]
53
- elsif column_for_attribute(column).type == :text && column == "term"
54
- normalize_term(self[column])
53
+ elsif column_for_attribute(column).type == :text && column =~ /term$/
54
+ normalize_term_column(self[column])
55
55
  else
56
56
  self[column]
57
57
  end
58
58
  end
59
59
 
60
- def normalize_term(text)
60
+ def normalize_term_column(text)
61
61
  text.gsub(/[^[:alnum:]]+/, ' ') if text
62
62
  end
63
63
 
@@ -1,3 +1,3 @@
1
1
  module HasSearcher
2
- VERSION = "0.0.4.1"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- - 1
10
- version: 0.0.4.1
8
+ - 5
9
+ version: 0.0.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - Dmitry Lihachev
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-04-20 00:00:00 +07:00
17
+ date: 2011-04-21 00:00:00 +07:00
19
18
  default_executable:
20
19
  dependencies: []
21
20