activeadmin-mongoid 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +48 -59
- data/README.md +5 -4
- data/activeadmin-mongoid.gemspec +3 -3
- data/lib/active_admin/mongoid.rb +1 -0
- data/lib/active_admin/mongoid/association/relatable.rb +14 -0
- data/lib/active_admin/mongoid/document.rb +1 -1
- data/lib/active_admin/mongoid/filter_form_builder.rb +1 -1
- data/lib/active_admin/mongoid/filters/resource_extension.rb +2 -2
- data/lib/active_admin/mongoid/version.rb +1 -1
- data/lib/meta_search/searches/mongoid.rb +1 -1
- data/spec/features/smoke_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -2
- data/test_app/config/application.rb +1 -0
- data/test_app/config/mongoid.6.yml +0 -7
- data/test_app/config/mongoid.7.yml +14 -0
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be7b4cf7a8d6adf31b32f4a10f1719f04b859fd62c062240a2d2519d70cfc739
|
4
|
+
data.tar.gz: '09d014d82d99ebadda2c05ed1f06327ed99931ee371fb2433ddf0806460a1017'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3cc3ccc47e25617aae19eddc3db1af073df07a22f39338297616bfe1f41eb29b734b18399a7f8409712a7837eb694de4344145af7d884b64210670acadca9af
|
7
|
+
data.tar.gz: 4b9b1da89366e1617206aa7a76aba19a54ed91240e0834588caff0f89b9a38f66ea9a89b42dcac0650f457cb90f3bd4c1c82cf47e11ef4e911e33f62b2613890
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -7,11 +7,11 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
activeadmin-mongoid (0.
|
10
|
+
activeadmin-mongoid (1.0.0)
|
11
11
|
activeadmin (>= 1.4.3)
|
12
12
|
jquery-rails
|
13
13
|
kaminari-mongoid
|
14
|
-
mongoid (
|
14
|
+
mongoid (>= 6.0, < 8.a)
|
15
15
|
sass-rails (>= 3.1.4)
|
16
16
|
|
17
17
|
GEM
|
@@ -40,18 +40,17 @@ GEM
|
|
40
40
|
erubi (~> 1.4)
|
41
41
|
rails-dom-testing (~> 2.0)
|
42
42
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
43
|
-
activeadmin (
|
44
|
-
arbre (
|
45
|
-
coffee-rails
|
43
|
+
activeadmin (2.6.0)
|
44
|
+
arbre (~> 1.2, >= 1.2.1)
|
46
45
|
formtastic (~> 3.1)
|
47
|
-
formtastic_i18n
|
48
|
-
inherited_resources (
|
49
|
-
jquery-rails (
|
50
|
-
kaminari (>= 0.
|
51
|
-
railties (>=
|
52
|
-
ransack (>= 1.
|
53
|
-
|
54
|
-
sprockets (< 4.1)
|
46
|
+
formtastic_i18n (~> 0.4)
|
47
|
+
inherited_resources (~> 1.7)
|
48
|
+
jquery-rails (~> 4.2)
|
49
|
+
kaminari (~> 1.0, >= 1.0.1)
|
50
|
+
railties (>= 5.2, < 6.1)
|
51
|
+
ransack (~> 2.1, >= 2.1.1)
|
52
|
+
sassc-rails (~> 2.1)
|
53
|
+
sprockets (>= 3.0, < 4.1)
|
55
54
|
activejob (5.2.3)
|
56
55
|
activesupport (= 5.2.3)
|
57
56
|
globalid (>= 0.3.6)
|
@@ -75,8 +74,8 @@ GEM
|
|
75
74
|
arbre (1.2.1)
|
76
75
|
activesupport (>= 3.0.0)
|
77
76
|
arel (9.0.0)
|
78
|
-
bcrypt (3.1.
|
79
|
-
bson (4.
|
77
|
+
bcrypt (3.1.13)
|
78
|
+
bson (4.7.1)
|
80
79
|
builder (3.2.3)
|
81
80
|
capybara (3.12.0)
|
82
81
|
addressable
|
@@ -88,26 +87,18 @@ GEM
|
|
88
87
|
xpath (~> 3.2)
|
89
88
|
cliver (0.3.2)
|
90
89
|
coderay (1.1.2)
|
91
|
-
coffee-rails (4.2.2)
|
92
|
-
coffee-script (>= 2.2.0)
|
93
|
-
railties (>= 4.0.0)
|
94
|
-
coffee-script (2.4.1)
|
95
|
-
coffee-script-source
|
96
|
-
execjs
|
97
|
-
coffee-script-source (1.12.2)
|
98
90
|
concurrent-ruby (1.1.5)
|
99
|
-
crass (1.0.
|
100
|
-
devise (4.
|
91
|
+
crass (1.0.5)
|
92
|
+
devise (4.7.1)
|
101
93
|
bcrypt (~> 3.0)
|
102
94
|
orm_adapter (~> 0.1)
|
103
|
-
railties (>= 4.1.0
|
95
|
+
railties (>= 4.1.0)
|
104
96
|
responders
|
105
97
|
warden (~> 1.2.3)
|
106
98
|
diff-lcs (1.3)
|
107
99
|
docile (1.3.1)
|
108
100
|
erubi (1.8.0)
|
109
|
-
|
110
|
-
ffi (1.10.0)
|
101
|
+
ffi (1.12.1)
|
111
102
|
formtastic (3.1.5)
|
112
103
|
actionpack (>= 3.2.13)
|
113
104
|
formtastic_i18n (0.6.0)
|
@@ -118,11 +109,11 @@ GEM
|
|
118
109
|
activesupport (>= 4.1)
|
119
110
|
i18n (1.6.0)
|
120
111
|
concurrent-ruby (~> 1.0)
|
121
|
-
inherited_resources (1.
|
122
|
-
actionpack (>= 5.0, < 6.
|
112
|
+
inherited_resources (1.11.0)
|
113
|
+
actionpack (>= 5.0, < 6.1)
|
123
114
|
has_scope (~> 0.6)
|
124
|
-
railties (>= 5.0, < 6.
|
125
|
-
responders (
|
115
|
+
railties (>= 5.0, < 6.1)
|
116
|
+
responders (>= 2, < 4)
|
126
117
|
jquery-rails (4.3.3)
|
127
118
|
rails-dom-testing (>= 1, < 3)
|
128
119
|
railties (>= 4.2.0)
|
@@ -149,7 +140,7 @@ GEM
|
|
149
140
|
mongoid
|
150
141
|
launchy (2.4.3)
|
151
142
|
addressable (~> 2.3)
|
152
|
-
loofah (2.
|
143
|
+
loofah (2.3.1)
|
153
144
|
crass (~> 1.0.2)
|
154
145
|
nokogiri (>= 1.5.9)
|
155
146
|
mail (2.7.1)
|
@@ -161,26 +152,28 @@ GEM
|
|
161
152
|
mini_mime (1.0.1)
|
162
153
|
mini_portile2 (2.4.0)
|
163
154
|
minitest (5.11.3)
|
164
|
-
mongo (2.
|
155
|
+
mongo (2.11.3)
|
165
156
|
bson (>= 4.4.2, < 5.0.0)
|
166
|
-
mongoid (
|
167
|
-
activemodel (>= 5.1, < 6.
|
157
|
+
mongoid (7.0.5)
|
158
|
+
activemodel (>= 5.1, < 6.1)
|
168
159
|
mongo (>= 2.5.1, < 3.0.0)
|
169
160
|
nio4r (2.3.1)
|
170
|
-
nokogiri (1.10.
|
161
|
+
nokogiri (1.10.5)
|
171
162
|
mini_portile2 (~> 2.4.0)
|
172
163
|
orm_adapter (0.5.0)
|
173
164
|
poltergeist (1.18.1)
|
174
165
|
capybara (>= 2.1, < 4)
|
175
166
|
cliver (~> 0.3.1)
|
176
167
|
websocket-driver (>= 0.2.0)
|
168
|
+
polyamorous (2.3.2)
|
169
|
+
activerecord (>= 5.2.1)
|
177
170
|
pry (0.12.2)
|
178
171
|
coderay (~> 1.1.0)
|
179
172
|
method_source (~> 0.9.0)
|
180
173
|
pry-rails (0.3.8)
|
181
174
|
pry (>= 0.10.4)
|
182
175
|
public_suffix (3.0.3)
|
183
|
-
rack (2.0.
|
176
|
+
rack (2.0.8)
|
184
177
|
rack-test (1.1.0)
|
185
178
|
rack (>= 1.0, < 3)
|
186
179
|
rails (5.2.3)
|
@@ -199,7 +192,7 @@ GEM
|
|
199
192
|
rails-dom-testing (2.0.3)
|
200
193
|
activesupport (>= 4.2.0)
|
201
194
|
nokogiri (>= 1.6)
|
202
|
-
rails-html-sanitizer (1.0
|
195
|
+
rails-html-sanitizer (1.2.0)
|
203
196
|
loofah (~> 2.2, >= 2.2.2)
|
204
197
|
railties (5.2.3)
|
205
198
|
actionpack (= 5.2.3)
|
@@ -207,15 +200,12 @@ GEM
|
|
207
200
|
method_source
|
208
201
|
rake (>= 0.8.7)
|
209
202
|
thor (>= 0.19.0, < 2.0)
|
210
|
-
rake (12.3.
|
211
|
-
ransack (2.
|
212
|
-
|
213
|
-
|
214
|
-
activesupport (>= 5.0)
|
203
|
+
rake (12.3.3)
|
204
|
+
ransack (2.3.2)
|
205
|
+
activerecord (>= 5.2.1)
|
206
|
+
activesupport (>= 5.2.1)
|
215
207
|
i18n
|
216
|
-
|
217
|
-
rb-inotify (0.10.0)
|
218
|
-
ffi (~> 1.0)
|
208
|
+
polyamorous (= 2.3.2)
|
219
209
|
regexp_parser (1.3.0)
|
220
210
|
responders (2.4.1)
|
221
211
|
actionpack (>= 4.2.0, < 6.0)
|
@@ -237,17 +227,16 @@ GEM
|
|
237
227
|
rspec-mocks (~> 3.8.0)
|
238
228
|
rspec-support (~> 3.8.0)
|
239
229
|
rspec-support (3.8.0)
|
240
|
-
sass (
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
sprockets
|
249
|
-
|
250
|
-
tilt (>= 1.1, < 3)
|
230
|
+
sass-rails (6.0.0)
|
231
|
+
sassc-rails (~> 2.1, >= 2.1.1)
|
232
|
+
sassc (2.2.1)
|
233
|
+
ffi (~> 1.9)
|
234
|
+
sassc-rails (2.1.2)
|
235
|
+
railties (>= 4.0.0)
|
236
|
+
sassc (>= 2.0)
|
237
|
+
sprockets (> 3.0)
|
238
|
+
sprockets-rails
|
239
|
+
tilt
|
251
240
|
simplecov (0.16.1)
|
252
241
|
docile (~> 1.1)
|
253
242
|
json (>= 1.8, < 3)
|
@@ -262,7 +251,7 @@ GEM
|
|
262
251
|
sprockets (>= 3.0.0)
|
263
252
|
thor (0.20.3)
|
264
253
|
thread_safe (0.3.6)
|
265
|
-
tilt (2.0.
|
254
|
+
tilt (2.0.10)
|
266
255
|
tzinfo (1.2.5)
|
267
256
|
thread_safe (~> 0.1)
|
268
257
|
warden (1.2.8)
|
@@ -286,7 +275,7 @@ DEPENDENCIES
|
|
286
275
|
launchy
|
287
276
|
poltergeist
|
288
277
|
pry-rails
|
289
|
-
rails (
|
278
|
+
rails (>= 5.2, < 6.1)
|
290
279
|
ransack-mongoid!
|
291
280
|
rspec-rails (~> 3.6)
|
292
281
|
simplecov
|
data/README.md
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
|
7
7
|
ActiveAdmin is holding off on pulling Mongoid support into the core ActiveAdmin application. This repo was pulled into the ActiveAdmin org from previous work done by Elia Schito, and will be maintained by Grzegorz Jakubiak, Nic Boie, JD Guzman, Elia Schito and other ActiveAdmin and community members.
|
8
8
|
|
9
|
-
### Requirements for version 0.
|
10
|
-
* Ruby 2.
|
9
|
+
### Requirements for version 1.0.0
|
10
|
+
* Ruby 2.4.0 or greater.
|
11
11
|
* Tested working on Rails 5.2.3
|
12
12
|
* Mongoid 6.x (**WARNING**:, using a Mongoid version >= 6.1.x has resulted in a fair amount of errors seen in the wild. Test your upgrade very carefully with any apps in which you're using this gem with Mongoid >= 6.1.x!)
|
13
|
-
* ActiveAdmin 1.4.3
|
13
|
+
* ActiveAdmin 1.4.3 or greater
|
14
14
|
* `ransack-mongoid` - it needs to be explicitly declared in Gemfile, pointing to github's master since it has no releases on rubygems yet.
|
15
15
|
|
16
16
|
## Previous versions
|
@@ -38,7 +38,7 @@ For more on Mongoid support in ActiveAdmin see [this issue](https://github.com/g
|
|
38
38
|
Add the following gems to your application's Gemfile, and lock the version:
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
gem 'activeadmin-mongoid', '0.
|
41
|
+
gem 'activeadmin-mongoid', '1.0.0'
|
42
42
|
gem 'ransack-mongoid', github: 'activerecord-hackery/ransack-mongoid'
|
43
43
|
```
|
44
44
|
|
@@ -61,6 +61,7 @@ with:
|
|
61
61
|
require "action_controller/railtie"
|
62
62
|
require "action_mailer/railtie"
|
63
63
|
require "active_resource/railtie"
|
64
|
+
require "action_view/railtie"
|
64
65
|
require "sprockets/railtie"
|
65
66
|
require "rails/test_unit/railtie"
|
66
67
|
```
|
data/activeadmin-mongoid.gemspec
CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
gem.version = ActiveAdmin::Mongoid::VERSION
|
19
19
|
gem.license = 'MIT'
|
20
|
-
|
21
|
-
gem.required_ruby_version = '>= 2.3'
|
22
20
|
|
23
|
-
gem.
|
21
|
+
gem.required_ruby_version = '>= 2.4'
|
22
|
+
|
23
|
+
gem.add_runtime_dependency 'mongoid', '>= 6.0', '< 8.a'
|
24
24
|
gem.add_runtime_dependency 'activeadmin', '>= 1.4.3'
|
25
25
|
gem.add_runtime_dependency 'kaminari-mongoid'
|
26
26
|
gem.add_runtime_dependency 'jquery-rails'
|
data/lib/active_admin/mongoid.rb
CHANGED
@@ -13,6 +13,7 @@ require 'active_admin/mongoid/document'
|
|
13
13
|
require 'active_admin/mongoid/helpers/collection'
|
14
14
|
require 'active_admin/mongoid/criteria'
|
15
15
|
require 'active_admin/mongoid/order_clause'
|
16
|
+
require 'active_admin/mongoid/association/relatable'
|
16
17
|
|
17
18
|
require 'active_admin/mongoid/inputs/filters/check_boxes_input'
|
18
19
|
require 'active_admin/mongoid/inputs/filters/select_input'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Mongoid::Association::Relatable.module_eval do
|
2
|
+
def macro
|
3
|
+
self.class.name.split('::').last.underscore.to_sym
|
4
|
+
end
|
5
|
+
|
6
|
+
def embeds?
|
7
|
+
[:embeds_one, :embeds_many].include?(macro)
|
8
|
+
end
|
9
|
+
|
10
|
+
def foreign_key
|
11
|
+
return if embeds?
|
12
|
+
foreign_key.to_sym rescue nil
|
13
|
+
end
|
14
|
+
end
|
@@ -53,7 +53,7 @@ module ActiveAdmin::Mongoid::Document
|
|
53
53
|
module ClassMethods
|
54
54
|
def content_columns
|
55
55
|
# cannot cache this, since changes in time (while defining fields)
|
56
|
-
fields.map(&:second).reject do |f|
|
56
|
+
fields.map(&:second).reject! do |f|
|
57
57
|
f.name =~ /(^_|^(created|updated)_at)/ or Mongoid::Fields::ForeignKey === f
|
58
58
|
end
|
59
59
|
end
|
@@ -3,10 +3,10 @@ require 'active_admin/filters/resource_extension'
|
|
3
3
|
module ActiveAdmin::Filters::ResourceExtension
|
4
4
|
def default_association_filters
|
5
5
|
if resource_class.respond_to?(:reflect_on_all_associations)
|
6
|
-
without_embedded = resource_class.reflect_on_all_associations.reject { |e|
|
6
|
+
without_embedded = resource_class.reflect_on_all_associations.reject { |e| e.embeds? }
|
7
7
|
poly, not_poly = without_embedded.partition{ |r| r.macro == :belongs_to && r.options[:polymorphic] }
|
8
8
|
|
9
|
-
filters = poly.map(&:
|
9
|
+
filters = poly.map(&:foreign_key) + not_poly.map(&:name)
|
10
10
|
filters.map &:to_sym
|
11
11
|
else
|
12
12
|
[]
|
@@ -92,7 +92,7 @@ module MetaSearch
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def metasearch_regexp
|
95
|
-
field_names = klass.fields.map
|
95
|
+
field_names = klass.fields.map{ |field| field.second.name }
|
96
96
|
conditions = MetaSearch::DEFAULT_WHERES.map {|condition| condition[0...-1]} # pop tail options
|
97
97
|
|
98
98
|
/\A(#{field_names.join('|')})_(#{conditions.join('|')})\z/
|
data/spec/features/smoke_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -4,6 +4,7 @@ require File.expand_path('../boot', __FILE__)
|
|
4
4
|
# require "active_record/railtie"
|
5
5
|
require "action_controller/railtie"
|
6
6
|
require "action_mailer/railtie"
|
7
|
+
require "action_view/railtie"
|
7
8
|
# require "active_resource/railtie"
|
8
9
|
require "sprockets/railtie"
|
9
10
|
require "rails/test_unit/railtie"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
@@ -11,22 +11,28 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-02-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: mongoid
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '6.0'
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 8.a
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
28
|
version_requirements: !ruby/object:Gem::Requirement
|
26
29
|
requirements:
|
27
|
-
- - "
|
30
|
+
- - ">="
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: '6.0'
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 8.a
|
30
36
|
- !ruby/object:Gem::Dependency
|
31
37
|
name: activeadmin
|
32
38
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +121,7 @@ files:
|
|
115
121
|
- Rakefile
|
116
122
|
- activeadmin-mongoid.gemspec
|
117
123
|
- lib/active_admin/mongoid.rb
|
124
|
+
- lib/active_admin/mongoid/association/relatable.rb
|
118
125
|
- lib/active_admin/mongoid/controllers/resource_controller.rb
|
119
126
|
- lib/active_admin/mongoid/criteria.rb
|
120
127
|
- lib/active_admin/mongoid/csv_builder.rb
|
@@ -186,6 +193,7 @@ files:
|
|
186
193
|
- test_app/config/mongoid.4.yml
|
187
194
|
- test_app/config/mongoid.5.yml
|
188
195
|
- test_app/config/mongoid.6.yml
|
196
|
+
- test_app/config/mongoid.7.yml
|
189
197
|
- test_app/config/routes.rb
|
190
198
|
- test_app/db/migrate/20130514223107_create_admin_notes.rb
|
191
199
|
- test_app/db/migrate/20130514223108_move_admin_notes_to_comments.rb
|
@@ -223,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
231
|
requirements:
|
224
232
|
- - ">="
|
225
233
|
- !ruby/object:Gem::Version
|
226
|
-
version: '2.
|
234
|
+
version: '2.4'
|
227
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
236
|
requirements:
|
229
237
|
- - ">="
|
@@ -231,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
239
|
version: '0'
|
232
240
|
requirements: []
|
233
241
|
rubyforge_project:
|
234
|
-
rubygems_version: 2.7.
|
242
|
+
rubygems_version: 2.7.6
|
235
243
|
signing_key:
|
236
244
|
specification_version: 4
|
237
245
|
summary: ActiveAdmin hacks to support Mongoid
|