rails3-jquery-autocomplete 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails3-jquery-autocomplete (0.6.5)
4
+ rails3-jquery-autocomplete (0.6.6)
5
5
  rails (~> 3.0.0)
6
6
  yajl-ruby
7
7
 
@@ -267,6 +267,8 @@ integration folder:
267
267
 
268
268
  # Changelog
269
269
 
270
+ * 0.6.6 ILIKE for postgres
271
+ * 0.6.5 JS select event
270
272
  * 0.6.4 Use YAJL instead of JSON
271
273
  * 0.6.3 SimpleForm plugin
272
274
  * 0.6.2 Fix Issue #8
@@ -99,13 +99,15 @@ module Rails3JQueryAutocomplete
99
99
  implementation = get_implementation(model)
100
100
  order = get_autocomplete_order(implementation, method, options)
101
101
 
102
+ like_clause = (defined?(PGconn) ? 'ILIKE' : 'LIKE')
103
+
102
104
  case implementation
103
105
  when :mongoid
104
106
  search = (is_full_search ? '.*' : '^') + term + '.*'
105
107
  items = model.where(method.to_sym => /#{search}/i).limit(limit).order_by(order)
106
108
  when :activerecord
107
109
  relation = model.select([:id, method] + (options[:extra_data].blank? ? [] : options[:extra_data])) unless options[:full_model]
108
- items = relation.where(["LOWER(#{method}) LIKE ?", "#{(is_full_search ? '%' : '')}#{term.downcase}%"]) \
110
+ items = relation.where(["LOWER(#{method}) #{like_clause} ?", "#{(is_full_search ? '%' : '')}#{term.downcase}%"]) \
109
111
  .limit(limit).order(order)
110
112
  end
111
113
  end
@@ -1,3 +1,3 @@
1
1
  module Rails3JQueryAutocomplete
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
3
3
  end
@@ -4,19 +4,20 @@ require 'generators/autocomplete_generator'
4
4
  class AutocompleteGeneratorTest < Test::Unit::TestCase
5
5
  def setup
6
6
  @destination = File.join('tmp', 'test_app')
7
- @source = AutocompleteGenerator.source_root
7
+ @source = AutocompleteGenerator.source_root
8
+ @filename = File.join(@destination, 'public', 'javascripts', 'autocomplete-rails.js')
9
+
10
+ File.unlink(@filename) if File.exists?(@filename)
8
11
 
9
12
  AutocompleteGenerator.start('', :destination_root => @destination)
10
13
  end
11
14
 
12
15
  def test_install
13
- assert File.exists?(
14
- File.join(@destination, 'public', 'javascripts', 'autocomplete-rails.js')
15
- )
16
+ assert File.exists?(@filename)
16
17
 
17
18
  assert_equal(
18
- File.read(File.join(@source, 'autocomplete-rails.js')),
19
- File.read(File.join(@destination, 'public', 'javascripts', 'autocomplete-rails.js'))
19
+ File.read(File.join(@source, 'autocomplete-rails.js')),
20
+ File.read(@filename)
20
21
  )
21
22
  end
22
23
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails3-jquery-autocomplete
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Padilla
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-04 00:00:00 -05:00
18
+ date: 2011-04-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency