simple_column_search 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v1.0.4. Spew an appropriate error on invalid match type.
2
+
1
3
  v1.0.3. General Ruby and Rails 3 compatibility.
2
4
 
3
5
  v1.0.2. Fixed SQL injection on Rails 3, and Rails 3 compatibility on Ruby 1.9.2.
@@ -21,6 +21,9 @@ module SimpleColumnSearch
21
21
  options[:match] ||= :start
22
22
  options[:name] ||= 'search'
23
23
 
24
+ # Test options at create time
25
+ get_simple_column_pattern(options[:match], 'test')
26
+
24
27
  # PostgreSQL LIKE is case-sensitive, use ILIKE for case-insensitive
25
28
  like = connection.adapter_name == "PostgreSQL" ? "ILIKE" : "LIKE"
26
29
  # Determine if ActiveRecord 3 or ActiveRecord 2.3 - probaly beter way to do it!
@@ -54,10 +57,11 @@ module SimpleColumnSearch
54
57
  when :end
55
58
  '%' + term
56
59
  else
57
- raise "Unexpected match type: #{options[:match]}"
60
+ raise InvalidMatcher, "Unexpected match type: #{match}"
58
61
  end
59
62
  end
60
63
 
64
+ class InvalidMatcher < StandardError; end
61
65
 
62
66
  end
63
67
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{simple_column_search}
5
- s.version = "1.0.3"
5
+ s.version = "1.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Elijah Miller"]
9
- s.date = %q{2010-09-08}
9
+ s.date = %q{2010-09-21}
10
10
  s.description = %q{Quick and dirty multi column LIKE searches.}
11
11
  s.email = %q{elijah.miller@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/simple_column_search.rb", "README.rdoc"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_column_search
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 3
10
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Elijah Miller
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-08 00:00:00 -04:00
18
+ date: 2010-09-21 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21