autocomplete_rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3705d9900a36155396f2cda10e3d54db913e0e1d
4
- data.tar.gz: 1ac76f990acb239985ab9c0f9f4a2aee1f761046
3
+ metadata.gz: 4ccdef2296052248af97c0cb75dda8821a4da3b8
4
+ data.tar.gz: 607b4b4a1135194a4c8bc9f9361a0f3b7eb41a6e
5
5
  SHA512:
6
- metadata.gz: 8e4924deed44b2137c982b28d4a37a141ea513594279f9fe80d4f714ab8d5787ef6fde4d78072658a02147d8178e21d32404ccf475f84d74086df430b70fc98d
7
- data.tar.gz: 7e3ef03657f129966b61399be51f3483b0916fb8c4f2a664e57b30cc467a76987cf55977d404f2fc06aa0d28143c86b837a1c9466310f08d28b9e79d964e805d
6
+ metadata.gz: 45f795b8b7e7af9f3b4e1c9b75f45598b71edc7abe160f52bef61e6771641e9ee33e01139502b186ab735f4fb2a1c80999cc9f4a67bff85fc63cfd629d0caa45
7
+ data.tar.gz: 672f9100ed76f6cc25adcf643477341b6322c32a09720fb11736f956f87fb9fb108ebe45c346d4449500f354f3a0e52fe00ca2de0efbefedb3c10658aadc861c
@@ -37,8 +37,9 @@ module AutocompleteRails
37
37
  # * :additional_data - collect additional data. Will be added to select unless full_model is invoked.
38
38
  # * :full_search - search the entire value string for the term. Defaults to false, in which case the value
39
39
  # field being searched (see value_method above) must start with the search term.
40
- # * :scopes - limit query to these ActiveRecord scopes, passed in as an array,
41
- # for example: `scopes: [:scope1, :scope2]`
40
+ # * :scopes - Build your autocomplete query from the specified ActiveRecord scope(s). Multiple scopes can be
41
+ # used, pass them in as an array. Example: `scopes: [:scope1, :scope2]`
42
+ # * :order - specify an order clause, defaults to 'LOWER(#{table}.#{value_method}) ASC'
42
43
  #
43
44
  # Be sure to add a route to reach the generated controller method. Example:
44
45
  #
@@ -98,7 +99,8 @@ module AutocompleteRails
98
99
  term = "%#{term}" if options[:full_search]
99
100
  table_name = model.table_name
100
101
  lower = options[:case_sensitive] ? '' : 'LOWER'
101
- ["#{lower}(#{table_name}.#{value_method}) LIKE #{lower}(?) ESCAPE \"\\\"", term]
102
+ ["#{lower}(#{table_name}.#{value_method}) LIKE #{lower}(?)", term] # escape default: \ on postgres, mysql, sqlite
103
+ # ["#{lower}(#{table_name}.#{value_method}) LIKE #{lower}(?) ESCAPE \"\\\"", term] # use single-quotes, not double
102
104
  end
103
105
 
104
106
  def autocomplete_limit_clause(options)
@@ -1,3 +1,3 @@
1
1
  module AutocompleteRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autocomplete_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Tomich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-29 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails