autocomplete_rails 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/autocomplete_rails/controller.rb +5 -3
- data/lib/autocomplete_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ccdef2296052248af97c0cb75dda8821a4da3b8
|
4
|
+
data.tar.gz: 607b4b4a1135194a4c8bc9f9361a0f3b7eb41a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 -
|
41
|
-
#
|
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}(?)
|
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)
|
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.
|
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-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|