ransack 1.5.1 → 1.6.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 +47 -3
- data/CHANGELOG.md +106 -18
- data/CONTRIBUTING.md +56 -23
- data/Gemfile +16 -5
- data/README.md +114 -38
- data/Rakefile +30 -2
- data/lib/ransack.rb +9 -0
- data/lib/ransack/adapters/active_record/3.0/compat.rb +11 -8
- data/lib/ransack/adapters/active_record/3.0/context.rb +14 -22
- data/lib/ransack/adapters/active_record/3.1/context.rb +14 -22
- data/lib/ransack/adapters/active_record/context.rb +36 -31
- data/lib/ransack/adapters/active_record/ransack/constants.rb +113 -0
- data/lib/ransack/adapters/active_record/ransack/context.rb +64 -0
- data/lib/ransack/adapters/active_record/ransack/nodes/condition.rb +48 -0
- data/lib/ransack/adapters/active_record/ransack/translate.rb +12 -0
- data/lib/ransack/adapters/active_record/ransack/visitor.rb +24 -0
- data/lib/ransack/adapters/mongoid.rb +13 -0
- data/lib/ransack/adapters/mongoid/3.2/.gitkeep +0 -0
- data/lib/ransack/adapters/mongoid/attributes/attribute.rb +37 -0
- data/lib/ransack/adapters/mongoid/attributes/order_predications.rb +17 -0
- data/lib/ransack/adapters/mongoid/attributes/predications.rb +141 -0
- data/lib/ransack/adapters/mongoid/base.rb +126 -0
- data/lib/ransack/adapters/mongoid/context.rb +208 -0
- data/lib/ransack/adapters/mongoid/inquiry_hash.rb +23 -0
- data/lib/ransack/adapters/mongoid/ransack/constants.rb +88 -0
- data/lib/ransack/adapters/mongoid/ransack/context.rb +60 -0
- data/lib/ransack/adapters/mongoid/ransack/nodes/condition.rb +27 -0
- data/lib/ransack/adapters/mongoid/ransack/translate.rb +13 -0
- data/lib/ransack/adapters/mongoid/ransack/visitor.rb +24 -0
- data/lib/ransack/adapters/mongoid/table.rb +35 -0
- data/lib/ransack/configuration.rb +22 -4
- data/lib/ransack/constants.rb +26 -120
- data/lib/ransack/context.rb +32 -60
- data/lib/ransack/helpers/form_builder.rb +50 -36
- data/lib/ransack/helpers/form_helper.rb +148 -104
- data/lib/ransack/naming.rb +11 -11
- data/lib/ransack/nodes.rb +2 -0
- data/lib/ransack/nodes/bindable.rb +12 -4
- data/lib/ransack/nodes/condition.rb +5 -22
- data/lib/ransack/nodes/grouping.rb +9 -10
- data/lib/ransack/nodes/sort.rb +3 -2
- data/lib/ransack/nodes/value.rb +1 -2
- data/lib/ransack/predicate.rb +3 -3
- data/lib/ransack/search.rb +46 -13
- data/lib/ransack/translate.rb +8 -8
- data/lib/ransack/version.rb +1 -1
- data/lib/ransack/visitor.rb +4 -16
- data/ransack.gemspec +1 -0
- data/spec/mongoid/adapters/mongoid/base_spec.rb +276 -0
- data/spec/mongoid/adapters/mongoid/context_spec.rb +56 -0
- data/spec/mongoid/configuration_spec.rb +66 -0
- data/spec/mongoid/dependencies_spec.rb +8 -0
- data/spec/mongoid/helpers/ransack_helper.rb +11 -0
- data/spec/mongoid/nodes/condition_spec.rb +34 -0
- data/spec/mongoid/nodes/grouping_spec.rb +13 -0
- data/spec/mongoid/predicate_spec.rb +155 -0
- data/spec/mongoid/search_spec.rb +446 -0
- data/spec/mongoid/support/mongoid.yml +6 -0
- data/spec/mongoid/support/schema.rb +128 -0
- data/spec/mongoid/translate_spec.rb +14 -0
- data/spec/mongoid_spec_helper.rb +59 -0
- data/spec/ransack/adapters/active_record/base_spec.rb +68 -35
- data/spec/ransack/dependencies_spec.rb +3 -1
- data/spec/ransack/helpers/form_builder_spec.rb +6 -6
- data/spec/ransack/helpers/form_helper_spec.rb +114 -47
- data/spec/ransack/nodes/condition_spec.rb +2 -2
- data/spec/ransack/search_spec.rb +2 -6
- data/spec/ransack/translate_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/support/schema.rb +9 -0
- metadata +49 -4
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
rails = ::ActiveRecord::VERSION::STRING.first(3)
|
2
|
+
|
3
|
+
if %w(3.2 4.0 4.1).include?(rails) || rails == '3.1' && RUBY_VERSION < '2.2'
|
2
4
|
describe 'Ransack' do
|
3
5
|
it 'can be required without errors' do
|
4
6
|
output = `bundle exec ruby -e "require 'ransack'" 2>&1`
|
@@ -18,12 +18,12 @@ module Ransack
|
|
18
18
|
@controller.instance_variable_set(:@_routes, router)
|
19
19
|
@controller.class_eval { include router.url_helpers }
|
20
20
|
@controller.view_context_class.class_eval { include router.url_helpers }
|
21
|
-
@s = Person.
|
21
|
+
@s = Person.ransack
|
22
22
|
@controller.view_context.search_form_for(@s) { |f| @f = f }
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'selects previously-entered time values with datetime_select' do
|
26
|
-
date_values = %w(2011 1 2 03 04 05)
|
26
|
+
date_values = %w(2011 1 2 03 04 05)
|
27
27
|
# @s.created_at_eq = date_values # This works in Rails 4.x but not 3.x
|
28
28
|
@s.created_at_eq = [2011, 1, 2, 3, 4, 5] # so we have to do this
|
29
29
|
html = @f.datetime_select(
|
@@ -57,7 +57,7 @@ module Ransack
|
|
57
57
|
end
|
58
58
|
context 'with `belongs_to` association attributes' do
|
59
59
|
before do
|
60
|
-
@controller.view_context.search_form_for(Comment.
|
60
|
+
@controller.view_context.search_form_for(Comment.ransack) { |f| @f = f }
|
61
61
|
end
|
62
62
|
it 'localizes :"#{singularized model}_#{attribute name}_#{predicate}"' do
|
63
63
|
test_label(@f, :article_body_start, /Article maiN BoDy starts with/)
|
@@ -132,7 +132,7 @@ module Ransack
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
it 'filters predicates with multi-value :only' do
|
135
|
-
html = @f.predicate_select only
|
135
|
+
html = @f.predicate_select :only => [:eq, :lt]
|
136
136
|
Predicate.names.reject { |k| k =~ /^(eq|lt)/ }.each do |key|
|
137
137
|
expect(html).not_to match /<option value="#{key}">/
|
138
138
|
end
|
@@ -147,7 +147,7 @@ module Ransack
|
|
147
147
|
|
148
148
|
context 'fields used in polymorphic relations as search attributes in form' do
|
149
149
|
before do
|
150
|
-
@controller.view_context.search_form_for(Note.
|
150
|
+
@controller.view_context.search_form_for(Note.ransack) { |f| @f = f }
|
151
151
|
end
|
152
152
|
it 'accepts poly_id field' do
|
153
153
|
html = @f.text_field(:notable_id_eq)
|
@@ -168,7 +168,7 @@ module Ransack
|
|
168
168
|
# Starting from Rails 4.2, the date_select html attributes are no longer
|
169
169
|
# `sort`ed (for a speed gain), so the tests have to be different:
|
170
170
|
def date_select_html(val)
|
171
|
-
if ::ActiveRecord::VERSION::STRING >= '4.2'
|
171
|
+
if ::ActiveRecord::VERSION::STRING >= '4.2'
|
172
172
|
%(<option value="#{val}" selected="selected">#{val}</option>)
|
173
173
|
else
|
174
174
|
%(<option selected="selected" value="#{val}">#{val}</option>)
|
@@ -7,6 +7,7 @@ module Ransack
|
|
7
7
|
router = ActionDispatch::Routing::RouteSet.new
|
8
8
|
router.draw do
|
9
9
|
resources :people
|
10
|
+
resources :notes
|
10
11
|
get ':controller(/:action(/:id(.:format)))'
|
11
12
|
end
|
12
13
|
|
@@ -42,12 +43,8 @@ module Ransack
|
|
42
43
|
end
|
43
44
|
)
|
44
45
|
}
|
45
|
-
it {
|
46
|
-
|
47
|
-
}
|
48
|
-
it {
|
49
|
-
should match /Full Name ▼/
|
50
|
-
}
|
46
|
+
it { should match /sort_link desc/ }
|
47
|
+
it { should match /Full Name ▼/ }
|
51
48
|
end
|
52
49
|
|
53
50
|
describe '#sort_link with default search_key defined as symbol' do
|
@@ -124,7 +121,7 @@ module Ransack
|
|
124
121
|
}
|
125
122
|
end
|
126
123
|
|
127
|
-
describe '#sort_link with
|
124
|
+
describe '#sort_link with search_key defined as a string' do
|
128
125
|
subject {
|
129
126
|
@controller.view_context.sort_link(
|
130
127
|
Person.search(
|
@@ -145,6 +142,18 @@ module Ransack
|
|
145
142
|
}
|
146
143
|
end
|
147
144
|
|
145
|
+
describe '#sort_link with default_order defined with a string key' do
|
146
|
+
subject { @controller.view_context
|
147
|
+
.sort_link(
|
148
|
+
[:main_app, Person.search()],
|
149
|
+
:name,
|
150
|
+
:controller => 'people',
|
151
|
+
'default_order' => 'desc'
|
152
|
+
)
|
153
|
+
}
|
154
|
+
it { should_not match /default_order/ }
|
155
|
+
end
|
156
|
+
|
148
157
|
describe '#sort_link with multiple search_keys defined as an array' do
|
149
158
|
subject { @controller.view_context
|
150
159
|
.sort_link(
|
@@ -158,12 +167,25 @@ module Ransack
|
|
158
167
|
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+asc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
159
168
|
)
|
160
169
|
}
|
161
|
-
it {
|
162
|
-
|
170
|
+
it { should match /sort_link desc/ }
|
171
|
+
it { should match /Full Name ▼/ }
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#sort_link with multiple search_keys does not break on nil values & ignores them' do
|
175
|
+
subject { @controller.view_context
|
176
|
+
.sort_link(
|
177
|
+
[:main_app, Person.search(:sorts => ['name desc', nil, 'email', nil])],
|
178
|
+
:name, [nil, :name, nil, 'email DESC', nil],
|
179
|
+
:controller => 'people'
|
180
|
+
)
|
163
181
|
}
|
164
182
|
it {
|
165
|
-
should match
|
183
|
+
should match(
|
184
|
+
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+asc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
185
|
+
)
|
166
186
|
}
|
187
|
+
it { should match /sort_link desc/ }
|
188
|
+
it { should match /Full Name ▼/ }
|
167
189
|
end
|
168
190
|
|
169
191
|
describe '#sort_link with multiple search_keys should allow a label to be specified' do
|
@@ -175,9 +197,7 @@ module Ransack
|
|
175
197
|
:controller => 'people'
|
176
198
|
)
|
177
199
|
}
|
178
|
-
it {
|
179
|
-
should match /Property Name ▼/
|
180
|
-
}
|
200
|
+
it { should match /Property Name ▼/ }
|
181
201
|
end
|
182
202
|
|
183
203
|
describe '#sort_link with multiple search_keys should flip multiple fields specified without a direction' do
|
@@ -193,21 +213,17 @@ module Ransack
|
|
193
213
|
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+asc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
194
214
|
)
|
195
215
|
}
|
196
|
-
it {
|
197
|
-
|
198
|
-
}
|
199
|
-
it {
|
200
|
-
should match /Full Name ▼/
|
201
|
-
}
|
216
|
+
it { should match /sort_link desc/ }
|
217
|
+
it { should match /Full Name ▼/ }
|
202
218
|
end
|
203
219
|
|
204
|
-
describe '#sort_link with multiple search_keys
|
220
|
+
describe '#sort_link with multiple search_keys and default_order specified as a string' do
|
205
221
|
subject { @controller.view_context
|
206
222
|
.sort_link(
|
207
223
|
[:main_app, Person.search()],
|
208
224
|
:name, [:name, :email],
|
209
225
|
:controller => 'people',
|
210
|
-
|
226
|
+
'default_order' => 'desc'
|
211
227
|
)
|
212
228
|
}
|
213
229
|
it {
|
@@ -215,12 +231,26 @@ module Ransack
|
|
215
231
|
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+desc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
216
232
|
)
|
217
233
|
}
|
218
|
-
it {
|
219
|
-
|
234
|
+
it { should match /sort_link/ }
|
235
|
+
it { should match /Full Name/ }
|
236
|
+
end
|
237
|
+
|
238
|
+
describe '#sort_link with multiple search_keys and default_order specified as a symbol' do
|
239
|
+
subject { @controller.view_context
|
240
|
+
.sort_link(
|
241
|
+
[:main_app, Person.search()],
|
242
|
+
:name, [:name, :email],
|
243
|
+
:controller => 'people',
|
244
|
+
:default_order => :desc
|
245
|
+
)
|
220
246
|
}
|
221
247
|
it {
|
222
|
-
should match
|
248
|
+
should match(
|
249
|
+
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+desc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
250
|
+
)
|
223
251
|
}
|
252
|
+
it { should match /sort_link/ }
|
253
|
+
it { should match /Full Name/ }
|
224
254
|
end
|
225
255
|
|
226
256
|
describe '#sort_link with multiple search_keys should allow multiple default_orders to be specified' do
|
@@ -237,12 +267,8 @@ module Ransack
|
|
237
267
|
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+desc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+asc/
|
238
268
|
)
|
239
269
|
}
|
240
|
-
it {
|
241
|
-
|
242
|
-
}
|
243
|
-
it {
|
244
|
-
should match /Full Name/
|
245
|
-
}
|
270
|
+
it { should match /sort_link/ }
|
271
|
+
it { should match /Full Name/ }
|
246
272
|
end
|
247
273
|
|
248
274
|
describe '#sort_link with multiple search_keys with multiple default_orders should not override a specified order' do
|
@@ -259,13 +285,30 @@ module Ransack
|
|
259
285
|
/people\?q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=name\+desc&q(%5B|\[)s(%5D|\])(%5B|\[)(%5D|\])=email\+desc/
|
260
286
|
)
|
261
287
|
}
|
262
|
-
it {
|
263
|
-
|
288
|
+
it { should match /sort_link/ }
|
289
|
+
it { should match /Full Name/ }
|
290
|
+
end
|
291
|
+
|
292
|
+
describe "#sort_link on polymorphic association should preserve association model name case" do
|
293
|
+
subject { @controller.view_context
|
294
|
+
.sort_link(
|
295
|
+
[:main_app, Note.search()],
|
296
|
+
:notable_of_Person_type_name, "Notable", :controller => 'notes'
|
297
|
+
)
|
264
298
|
}
|
265
299
|
it {
|
266
|
-
should match
|
300
|
+
should match(
|
301
|
+
if ActiveRecord::VERSION::STRING =~ /^3\.[1-2]\./
|
302
|
+
/notes\?q%5Bs%5D=notable_of_Person_type_name\+asc/
|
303
|
+
else
|
304
|
+
/notes\?q(%5B|\[)s(%5D|\])=notable_of_Person_type_name\+asc/
|
305
|
+
end
|
306
|
+
)
|
267
307
|
}
|
308
|
+
it { should match /sort_link/ }
|
309
|
+
it { should match /Notable/ }
|
268
310
|
end
|
311
|
+
|
269
312
|
context 'view has existing parameters' do
|
270
313
|
before do
|
271
314
|
@controller.view_context.params.merge!({ :exist => 'existing' })
|
@@ -280,20 +323,37 @@ module Ransack
|
|
280
323
|
:controller => 'people'
|
281
324
|
)
|
282
325
|
}
|
283
|
-
it {
|
284
|
-
should match /exist\=existing/
|
285
|
-
}
|
326
|
+
it { should match /exist\=existing/ }
|
286
327
|
end
|
287
328
|
end
|
288
329
|
|
289
|
-
describe '#
|
290
|
-
subject {
|
291
|
-
|
292
|
-
|
330
|
+
describe '#sort_link with hide order indicator set to true' do
|
331
|
+
subject { @controller.view_context
|
332
|
+
.sort_link(
|
333
|
+
[:main_app, Person.search(:sorts => ['name desc'])],
|
334
|
+
:name,
|
335
|
+
:controller => 'people',
|
336
|
+
:hide_indicator => true
|
337
|
+
)
|
293
338
|
}
|
294
|
-
it {
|
295
|
-
|
339
|
+
it { should match /Full Name/ }
|
340
|
+
end
|
341
|
+
|
342
|
+
describe '#sort_link with hide order indicator set to false' do
|
343
|
+
subject { @controller.view_context
|
344
|
+
.sort_link(
|
345
|
+
[:main_app, Person.search(:sorts => ['name desc'])],
|
346
|
+
:name,
|
347
|
+
:controller => 'people',
|
348
|
+
:hide_indicator => false
|
349
|
+
)
|
296
350
|
}
|
351
|
+
it { should match /Full Name ▼/ }
|
352
|
+
end
|
353
|
+
|
354
|
+
describe '#search_form_for with default format' do
|
355
|
+
subject { @controller.view_context.search_form_for(Person.search) {} }
|
356
|
+
it { should match /action="\/people"/ }
|
297
357
|
end
|
298
358
|
|
299
359
|
describe '#search_form_for with pdf format' do
|
@@ -301,9 +361,7 @@ module Ransack
|
|
301
361
|
@controller.view_context
|
302
362
|
.search_form_for(Person.search, :format => :pdf) {}
|
303
363
|
}
|
304
|
-
it {
|
305
|
-
should match /action="\/people.pdf"/
|
306
|
-
}
|
364
|
+
it { should match /action="\/people.pdf"/ }
|
307
365
|
end
|
308
366
|
|
309
367
|
describe '#search_form_for with json format' do
|
@@ -311,9 +369,18 @@ module Ransack
|
|
311
369
|
@controller.view_context
|
312
370
|
.search_form_for(Person.search, :format => :json) {}
|
313
371
|
}
|
314
|
-
it {
|
315
|
-
|
372
|
+
it { should match /action="\/people.json"/ }
|
373
|
+
end
|
374
|
+
|
375
|
+
describe '#search_form_for with custom default search key' do
|
376
|
+
before do
|
377
|
+
Ransack.configure { |c| c.search_key = :example }
|
378
|
+
end
|
379
|
+
subject {
|
380
|
+
@controller.view_context
|
381
|
+
.search_form_for(Person.search) { |f| f.text_field :name_eq }
|
316
382
|
}
|
383
|
+
it { should match /example_name_eq/ }
|
317
384
|
end
|
318
385
|
|
319
386
|
end
|
@@ -23,7 +23,7 @@ module Ransack
|
|
23
23
|
|
24
24
|
context "when ignore_unknown_conditions is false" do
|
25
25
|
before do
|
26
|
-
Ransack.configure { |
|
26
|
+
Ransack.configure { |c| c.ignore_unknown_conditions = false }
|
27
27
|
end
|
28
28
|
|
29
29
|
specify { expect { subject }.to raise_error ArgumentError }
|
@@ -31,7 +31,7 @@ module Ransack
|
|
31
31
|
|
32
32
|
context "when ignore_unknown_conditions is true" do
|
33
33
|
before do
|
34
|
-
Ransack.configure { |
|
34
|
+
Ransack.configure { |c| c.ignore_unknown_conditions = true }
|
35
35
|
end
|
36
36
|
|
37
37
|
specify { subject.should be_nil }
|
data/spec/ransack/search_spec.rb
CHANGED
@@ -178,9 +178,7 @@ module Ransack
|
|
178
178
|
|
179
179
|
context "when ignore_unknown_conditions is false" do
|
180
180
|
before do
|
181
|
-
Ransack.configure { |
|
182
|
-
config.ignore_unknown_conditions = false
|
183
|
-
}
|
181
|
+
Ransack.configure { |c| c.ignore_unknown_conditions = false }
|
184
182
|
end
|
185
183
|
|
186
184
|
specify { expect { subject }.to raise_error ArgumentError }
|
@@ -188,9 +186,7 @@ module Ransack
|
|
188
186
|
|
189
187
|
context "when ignore_unknown_conditions is true" do
|
190
188
|
before do
|
191
|
-
Ransack.configure { |
|
192
|
-
config.ignore_unknown_conditions = true
|
193
|
-
}
|
189
|
+
Ransack.configure { |c| c.ignore_unknown_conditions = true }
|
194
190
|
end
|
195
191
|
|
196
192
|
specify { expect { subject }.not_to raise_error }
|
@@ -8,7 +8,7 @@ module Ransack
|
|
8
8
|
ar_translation = ::Namespace::Article.human_attribute_name(:title)
|
9
9
|
ransack_translation = Ransack::Translate.attribute(
|
10
10
|
:title,
|
11
|
-
:context => ::Namespace::Article.
|
11
|
+
:context => ::Namespace::Article.ransack.context
|
12
12
|
)
|
13
13
|
expect(ransack_translation).to eq ar_translation
|
14
14
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,15 +2,14 @@ require 'machinist/active_record'
|
|
2
2
|
require 'sham'
|
3
3
|
require 'faker'
|
4
4
|
require 'ransack'
|
5
|
+
require 'pry'
|
5
6
|
|
6
7
|
I18n.enforce_available_locales = false
|
7
8
|
Time.zone = 'Eastern Time (US & Canada)'
|
8
9
|
I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'support', '*.yml')]
|
9
10
|
|
10
11
|
Dir[File.expand_path('../{helpers,support,blueprints}/*.rb', __FILE__)]
|
11
|
-
.each
|
12
|
-
require f
|
13
|
-
end
|
12
|
+
.each { |f| require f }
|
14
13
|
|
15
14
|
Sham.define do
|
16
15
|
name { Faker::Name.name }
|
data/spec/support/schema.rb
CHANGED
@@ -39,11 +39,20 @@ class Person < ActiveRecord::Base
|
|
39
39
|
scope :restricted, lambda { where("restricted = 1") }
|
40
40
|
scope :active, lambda { where("active = 1") }
|
41
41
|
scope :over_age, lambda { |y| where(["age > ?", y]) }
|
42
|
+
scope :of_age, lambda { |of_age| of_age ? where("age >= ?", 18) : where("age < ?", 18) }
|
42
43
|
|
43
44
|
ransacker :reversed_name, :formatter => proc { |v| v.reverse } do |parent|
|
44
45
|
parent.table[:name]
|
45
46
|
end
|
46
47
|
|
48
|
+
ransacker :array_users, formatter: proc { |v| Person.first(2).map(&:id) } do |parent|
|
49
|
+
parent.table[:id]
|
50
|
+
end
|
51
|
+
|
52
|
+
ransacker :array_names, formatter: proc { |v| Person.first(2).map {|p| p.id.to_s } } do |parent|
|
53
|
+
parent.table[:name]
|
54
|
+
end
|
55
|
+
|
47
56
|
ransacker :doubled_name do |parent|
|
48
57
|
Arel::Nodes::InfixOperation.new(
|
49
58
|
'||', parent.table[:name], parent.table[:name]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Miller
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -207,6 +207,25 @@ files:
|
|
207
207
|
- lib/ransack/adapters/active_record/base.rb
|
208
208
|
- lib/ransack/adapters/active_record/compat.rb
|
209
209
|
- lib/ransack/adapters/active_record/context.rb
|
210
|
+
- lib/ransack/adapters/active_record/ransack/constants.rb
|
211
|
+
- lib/ransack/adapters/active_record/ransack/context.rb
|
212
|
+
- lib/ransack/adapters/active_record/ransack/nodes/condition.rb
|
213
|
+
- lib/ransack/adapters/active_record/ransack/translate.rb
|
214
|
+
- lib/ransack/adapters/active_record/ransack/visitor.rb
|
215
|
+
- lib/ransack/adapters/mongoid.rb
|
216
|
+
- lib/ransack/adapters/mongoid/3.2/.gitkeep
|
217
|
+
- lib/ransack/adapters/mongoid/attributes/attribute.rb
|
218
|
+
- lib/ransack/adapters/mongoid/attributes/order_predications.rb
|
219
|
+
- lib/ransack/adapters/mongoid/attributes/predications.rb
|
220
|
+
- lib/ransack/adapters/mongoid/base.rb
|
221
|
+
- lib/ransack/adapters/mongoid/context.rb
|
222
|
+
- lib/ransack/adapters/mongoid/inquiry_hash.rb
|
223
|
+
- lib/ransack/adapters/mongoid/ransack/constants.rb
|
224
|
+
- lib/ransack/adapters/mongoid/ransack/context.rb
|
225
|
+
- lib/ransack/adapters/mongoid/ransack/nodes/condition.rb
|
226
|
+
- lib/ransack/adapters/mongoid/ransack/translate.rb
|
227
|
+
- lib/ransack/adapters/mongoid/ransack/visitor.rb
|
228
|
+
- lib/ransack/adapters/mongoid/table.rb
|
210
229
|
- lib/ransack/configuration.rb
|
211
230
|
- lib/ransack/constants.rb
|
212
231
|
- lib/ransack/context.rb
|
@@ -244,6 +263,19 @@ files:
|
|
244
263
|
- spec/blueprints/tags.rb
|
245
264
|
- spec/console.rb
|
246
265
|
- spec/helpers/ransack_helper.rb
|
266
|
+
- spec/mongoid/adapters/mongoid/base_spec.rb
|
267
|
+
- spec/mongoid/adapters/mongoid/context_spec.rb
|
268
|
+
- spec/mongoid/configuration_spec.rb
|
269
|
+
- spec/mongoid/dependencies_spec.rb
|
270
|
+
- spec/mongoid/helpers/ransack_helper.rb
|
271
|
+
- spec/mongoid/nodes/condition_spec.rb
|
272
|
+
- spec/mongoid/nodes/grouping_spec.rb
|
273
|
+
- spec/mongoid/predicate_spec.rb
|
274
|
+
- spec/mongoid/search_spec.rb
|
275
|
+
- spec/mongoid/support/mongoid.yml
|
276
|
+
- spec/mongoid/support/schema.rb
|
277
|
+
- spec/mongoid/translate_spec.rb
|
278
|
+
- spec/mongoid_spec_helper.rb
|
247
279
|
- spec/ransack/adapters/active_record/base_spec.rb
|
248
280
|
- spec/ransack/adapters/active_record/context_spec.rb
|
249
281
|
- spec/ransack/configuration_spec.rb
|
@@ -270,7 +302,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
270
302
|
requirements:
|
271
303
|
- - ">="
|
272
304
|
- !ruby/object:Gem::Version
|
273
|
-
version: '
|
305
|
+
version: '1.9'
|
274
306
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
307
|
requirements:
|
276
308
|
- - ">="
|
@@ -278,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
310
|
version: '0'
|
279
311
|
requirements: []
|
280
312
|
rubyforge_project: ransack
|
281
|
-
rubygems_version: 2.4.
|
313
|
+
rubygems_version: 2.4.5
|
282
314
|
signing_key:
|
283
315
|
specification_version: 4
|
284
316
|
summary: Object-based searching for ActiveRecord (currently).
|
@@ -290,6 +322,19 @@ test_files:
|
|
290
322
|
- spec/blueprints/tags.rb
|
291
323
|
- spec/console.rb
|
292
324
|
- spec/helpers/ransack_helper.rb
|
325
|
+
- spec/mongoid/adapters/mongoid/base_spec.rb
|
326
|
+
- spec/mongoid/adapters/mongoid/context_spec.rb
|
327
|
+
- spec/mongoid/configuration_spec.rb
|
328
|
+
- spec/mongoid/dependencies_spec.rb
|
329
|
+
- spec/mongoid/helpers/ransack_helper.rb
|
330
|
+
- spec/mongoid/nodes/condition_spec.rb
|
331
|
+
- spec/mongoid/nodes/grouping_spec.rb
|
332
|
+
- spec/mongoid/predicate_spec.rb
|
333
|
+
- spec/mongoid/search_spec.rb
|
334
|
+
- spec/mongoid/support/mongoid.yml
|
335
|
+
- spec/mongoid/support/schema.rb
|
336
|
+
- spec/mongoid/translate_spec.rb
|
337
|
+
- spec/mongoid_spec_helper.rb
|
293
338
|
- spec/ransack/adapters/active_record/base_spec.rb
|
294
339
|
- spec/ransack/adapters/active_record/context_spec.rb
|
295
340
|
- spec/ransack/configuration_spec.rb
|