mobility-ransack 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +94 -23
- data/README.md +31 -3
- data/lib/mobility/ransack/version.rb +1 -1
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dbe32e639522abd94240700245b21f05c4404d02ba180232d4b29244c37b5ec
|
4
|
+
data.tar.gz: e765f0db6c2520582997dc9d508af9e133a9d99bbc481e030e496dd21d600fe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2a55f29a6973ee06e99f4c479a035f60ccd339e415916ca6bd1695289642ccfa0f5812107b761741a1afd81d29bc00c8c9084bd8c29ce3a88922abf65ca277
|
7
|
+
data.tar.gz: 6196722b6897c97cd982bdcccc2a0f4202177ba7a12605596254df2477859457814fc07e2b26f3021bcc643394ba4126a595898132e2bae32a0ea53208eecda4
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -4,3 +4,18 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in mobility-ransack.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
group :development, :test do
|
9
|
+
if ENV['RAILS_VERSION'] == '5.1'
|
10
|
+
gem 'rails', '>= 5.1', '< 5.2'
|
11
|
+
elsif ENV['RAILS_VERSION'] == '5.0'
|
12
|
+
gem 'rails', '>= 5.0', '< 5.1'
|
13
|
+
else
|
14
|
+
gem 'rails', '>= 5.2.0.rc2', '< 5.3'
|
15
|
+
# see: https://github.com/activerecord-hackery/ransack/issues/948#issuecomment-412414365
|
16
|
+
gem 'ransack', '~> 2.0.0'
|
17
|
+
end
|
18
|
+
|
19
|
+
gem 'pry'
|
20
|
+
gem 'pry-byebug'
|
21
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -3,66 +3,120 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
mobility-ransack (0.0.1)
|
5
5
|
mobility (~> 0.8.0)
|
6
|
-
ransack (
|
6
|
+
ransack (>= 1.8.0, < 2.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
actioncable (5.2.1)
|
12
|
+
actionpack (= 5.2.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.1)
|
16
|
+
actionpack (= 5.2.1)
|
17
|
+
actionview (= 5.2.1)
|
18
|
+
activejob (= 5.2.1)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.1)
|
22
|
+
actionview (= 5.2.1)
|
23
|
+
activesupport (= 5.2.1)
|
14
24
|
rack (~> 2.0)
|
15
|
-
rack-test (
|
25
|
+
rack-test (>= 0.6.3)
|
16
26
|
rails-dom-testing (~> 2.0)
|
17
27
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
-
actionview (5.
|
19
|
-
activesupport (= 5.
|
28
|
+
actionview (5.2.1)
|
29
|
+
activesupport (= 5.2.1)
|
20
30
|
builder (~> 3.1)
|
21
31
|
erubi (~> 1.4)
|
22
32
|
rails-dom-testing (~> 2.0)
|
23
33
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
24
|
-
|
25
|
-
activesupport (= 5.
|
26
|
-
|
27
|
-
|
28
|
-
activesupport (= 5.
|
29
|
-
|
30
|
-
|
34
|
+
activejob (5.2.1)
|
35
|
+
activesupport (= 5.2.1)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.1)
|
38
|
+
activesupport (= 5.2.1)
|
39
|
+
activerecord (5.2.1)
|
40
|
+
activemodel (= 5.2.1)
|
41
|
+
activesupport (= 5.2.1)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.1)
|
44
|
+
actionpack (= 5.2.1)
|
45
|
+
activerecord (= 5.2.1)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.1)
|
31
48
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
32
|
-
i18n (
|
49
|
+
i18n (>= 0.7, < 2)
|
33
50
|
minitest (~> 5.1)
|
34
51
|
tzinfo (~> 1.1)
|
35
|
-
arel (
|
52
|
+
arel (9.0.0)
|
36
53
|
builder (3.2.3)
|
54
|
+
byebug (10.0.2)
|
55
|
+
coderay (1.1.2)
|
37
56
|
concurrent-ruby (1.0.5)
|
38
57
|
crass (1.0.4)
|
39
58
|
diff-lcs (1.3)
|
40
59
|
erubi (1.7.1)
|
41
|
-
|
60
|
+
globalid (0.4.1)
|
61
|
+
activesupport (>= 4.2.0)
|
62
|
+
i18n (1.0.1)
|
42
63
|
concurrent-ruby (~> 1.0)
|
43
64
|
loofah (2.2.2)
|
44
65
|
crass (~> 1.0.2)
|
45
66
|
nokogiri (>= 1.5.9)
|
67
|
+
mail (2.7.0)
|
68
|
+
mini_mime (>= 0.1.1)
|
69
|
+
marcel (0.3.2)
|
70
|
+
mimemagic (~> 0.3.2)
|
71
|
+
method_source (0.9.0)
|
72
|
+
mimemagic (0.3.2)
|
73
|
+
mini_mime (1.0.1)
|
46
74
|
mini_portile2 (2.3.0)
|
47
75
|
minitest (5.11.3)
|
48
76
|
mobility (0.8.0)
|
49
77
|
i18n (>= 0.6.10, < 1.1)
|
50
78
|
request_store (~> 1.0)
|
79
|
+
nio4r (2.3.1)
|
51
80
|
nokogiri (1.8.4)
|
52
81
|
mini_portile2 (~> 2.3.0)
|
82
|
+
pry (0.11.3)
|
83
|
+
coderay (~> 1.1.0)
|
84
|
+
method_source (~> 0.9.0)
|
85
|
+
pry-byebug (3.6.0)
|
86
|
+
byebug (~> 10.0)
|
87
|
+
pry (~> 0.10)
|
53
88
|
rack (2.0.5)
|
54
|
-
rack-test (
|
55
|
-
rack (>= 1.0)
|
89
|
+
rack-test (1.1.0)
|
90
|
+
rack (>= 1.0, < 3)
|
91
|
+
rails (5.2.1)
|
92
|
+
actioncable (= 5.2.1)
|
93
|
+
actionmailer (= 5.2.1)
|
94
|
+
actionpack (= 5.2.1)
|
95
|
+
actionview (= 5.2.1)
|
96
|
+
activejob (= 5.2.1)
|
97
|
+
activemodel (= 5.2.1)
|
98
|
+
activerecord (= 5.2.1)
|
99
|
+
activestorage (= 5.2.1)
|
100
|
+
activesupport (= 5.2.1)
|
101
|
+
bundler (>= 1.3.0)
|
102
|
+
railties (= 5.2.1)
|
103
|
+
sprockets-rails (>= 2.0.0)
|
56
104
|
rails-dom-testing (2.0.3)
|
57
105
|
activesupport (>= 4.2.0)
|
58
106
|
nokogiri (>= 1.6)
|
59
107
|
rails-html-sanitizer (1.0.4)
|
60
108
|
loofah (~> 2.2, >= 2.2.2)
|
109
|
+
railties (5.2.1)
|
110
|
+
actionpack (= 5.2.1)
|
111
|
+
activesupport (= 5.2.1)
|
112
|
+
method_source
|
113
|
+
rake (>= 0.8.7)
|
114
|
+
thor (>= 0.19.0, < 2.0)
|
61
115
|
rake (10.5.0)
|
62
|
-
ransack (
|
63
|
-
actionpack (>=
|
64
|
-
activerecord (>=
|
65
|
-
activesupport (>=
|
116
|
+
ransack (2.0.1)
|
117
|
+
actionpack (>= 5.0)
|
118
|
+
activerecord (>= 5.0)
|
119
|
+
activesupport (>= 5.0)
|
66
120
|
i18n
|
67
121
|
request_store (1.4.1)
|
68
122
|
rack (>= 1.4)
|
@@ -79,17 +133,34 @@ GEM
|
|
79
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
134
|
rspec-support (~> 3.8.0)
|
81
135
|
rspec-support (3.8.0)
|
136
|
+
sprockets (3.7.2)
|
137
|
+
concurrent-ruby (~> 1.0)
|
138
|
+
rack (> 1, < 3)
|
139
|
+
sprockets-rails (3.2.1)
|
140
|
+
actionpack (>= 4.0)
|
141
|
+
activesupport (>= 4.0)
|
142
|
+
sprockets (>= 3.0.0)
|
143
|
+
sqlite3 (1.3.13)
|
144
|
+
thor (0.20.0)
|
82
145
|
thread_safe (0.3.6)
|
83
146
|
tzinfo (1.2.5)
|
84
147
|
thread_safe (~> 0.1)
|
148
|
+
websocket-driver (0.7.0)
|
149
|
+
websocket-extensions (>= 0.1.0)
|
150
|
+
websocket-extensions (0.1.3)
|
85
151
|
|
86
152
|
PLATFORMS
|
87
153
|
ruby
|
88
154
|
|
89
155
|
DEPENDENCIES
|
90
156
|
mobility-ransack!
|
157
|
+
pry
|
158
|
+
pry-byebug
|
159
|
+
rails (>= 5.2.0.rc2, < 5.3)
|
91
160
|
rake (~> 10.0)
|
161
|
+
ransack (~> 2.0.0)
|
92
162
|
rspec (~> 3.0)
|
163
|
+
sqlite3
|
93
164
|
|
94
165
|
BUNDLED WITH
|
95
166
|
1.16.1
|
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Mobility Ransack
|
2
2
|
================
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/mobility-ransack.svg)][gem]
|
5
|
+
[![Build Status](https://travis-ci.org/shioyama/mobility-ransack.svg?branch=master)][travis]
|
6
|
+
|
7
|
+
[gem]: https://rubygems.org/gems/friendly_id-mobility
|
8
|
+
[travis]: https://travis-ci.org/shioyama/friendly_id-mobility
|
9
|
+
|
4
10
|
Search on translated attributes with
|
5
11
|
[Mobility](https://github.com/shioyama/mobility) and
|
6
12
|
[Ransack](https://github.com/activerecord-hackery/ransack).
|
@@ -10,10 +16,24 @@ Search on translated attributes with
|
|
10
16
|
Just add the gem to your Gemfile:
|
11
17
|
|
12
18
|
```ruby
|
13
|
-
gem 'mobility-ransack'
|
19
|
+
gem 'mobility-ransack', '~> 0.1.0'
|
14
20
|
```
|
15
21
|
|
16
|
-
Now enable ransack
|
22
|
+
Now enable the `ransack` plugin in Mobility's configuration so that it can be
|
23
|
+
used, and optionally set the value for the `:ransack` key in `default_options`
|
24
|
+
to `true` to enable it for all translated attributes on all models.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Mobility.configure do |config|
|
28
|
+
# ...
|
29
|
+
config.plugins += [:ransack]
|
30
|
+
# config.default_options[:ransack] = true
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
If you left the `default_options` line above commented out, you will need to
|
35
|
+
explicitly enable ransack for each attribute you want to search on with the
|
36
|
+
`ransack` option, like this:
|
17
37
|
|
18
38
|
```ruby
|
19
39
|
class Post < ApplicationRecord
|
@@ -22,7 +42,15 @@ class Post < ApplicationRecord
|
|
22
42
|
end
|
23
43
|
```
|
24
44
|
|
25
|
-
|
45
|
+
You can search on `foo` with Ransack just like any untranslated attribute, e.g.
|
46
|
+
if `Post` has a `title` attribute translated with the Jsonb backend:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Post.ransack(title_cont: "foo").result
|
50
|
+
#=> SELECT "posts".* FROM "posts" WHERE ("posts"."title" ->> 'en') ILIKE '%foo%'
|
51
|
+
```
|
52
|
+
|
53
|
+
Other backends work exactly the same way.
|
26
54
|
|
27
55
|
## License
|
28
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobility-ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
@@ -14,16 +14,22 @@ dependencies:
|
|
14
14
|
name: ransack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.8.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 1.8.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: mobility
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +72,20 @@ dependencies:
|
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '3.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: sqlite3
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
69
89
|
description:
|
70
90
|
email:
|
71
91
|
- chris@dejimata.com
|
@@ -73,6 +93,7 @@ executables: []
|
|
73
93
|
extensions: []
|
74
94
|
extra_rdoc_files: []
|
75
95
|
files:
|
96
|
+
- CHANGELOG.md
|
76
97
|
- Gemfile
|
77
98
|
- Gemfile.lock
|
78
99
|
- LICENSE.txt
|