upnxt-ransack 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/ransack.rb +0 -37
- data/lib/upnxt-ransack.rb +1 -0
- data/lib/upnxt/ransack/engine.rb +1 -0
- data/lib/upnxt/ransack/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42063c66fee0ea9a0d243a92e5a87243e9aecc7f
|
4
|
+
data.tar.gz: e1dc086f15edd572b1ed8ee0e7e59851ce8064db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e834ac8eaf2a9bee66d694911672991eaa624398fc7b22ddea27152f0d821ddd7c7dbc98f4f3425604b05c403b50a889afe6637dfbb04f838cc1abbd95ac0b
|
7
|
+
data.tar.gz: 93e118ca8d29df4d10a094cfe7db44ea3ee37b1025475fb0809bbff654fb6a2c57957a78982e11c8810d91378108eb6c6158811b26e151d28e0b5d3873e0a14f
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Ransack
|
2
|
-
class Search
|
3
|
-
alias :old_initializer :initialize
|
4
|
-
|
5
|
-
def initialize(object, params = {}, options = {})
|
6
|
-
params.each do |str, _|
|
7
|
-
str = str.to_s
|
8
|
-
Predicate.detect_and_strip_from_string!(str)
|
9
|
-
assoc = convert_to_associations(object, str)
|
10
|
-
last = assoc.pop
|
11
|
-
attr_name = last.last
|
12
|
-
prev_class_sym = last.first.name.underscore.to_sym
|
13
|
-
prev_assoc_sym = nil
|
14
|
-
assoc.reverse.each do |klass, str|
|
15
|
-
assoc_sym = str.sub(/_#{attr_name}\z/, '').to_sym
|
16
|
-
klass.has_one(assoc_sym, through: prev_class_sym, source: prev_assoc_sym) unless klass.reflections.keys.include?(assoc_sym)
|
17
|
-
prev_assoc_sym = assoc_sym
|
18
|
-
prev_class_sym = klass.name.underscore.to_sym
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
old_initializer(object, params, options)
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
def convert_to_associations(klass, str)
|
27
|
-
#sort backwards to favor longer names
|
28
|
-
Hash[klass.reflections.sort{|a,b| b<=>a}].each do |name, reflection|
|
29
|
-
if str.start_with? name.to_s
|
30
|
-
result = convert_to_associations(reflection.class_name.constantize, str.sub("#{name.to_s}_", ''))
|
31
|
-
return [[klass, str]].concat(result) if result
|
32
|
-
end
|
33
|
-
end
|
34
|
-
return [[klass, str]] if klass.attribute_names.include?(str)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/lib/upnxt-ransack.rb
CHANGED
data/lib/upnxt/ransack/engine.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upnxt-ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bert bruynooghe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ransack
|
@@ -41,7 +41,8 @@ homepage: https://github.com/UP-nxt/upnxt-ransack
|
|
41
41
|
licenses:
|
42
42
|
- MIT
|
43
43
|
metadata: {}
|
44
|
-
post_install_message:
|
44
|
+
post_install_message: upnxt-ransack is currently discontinued in favor of upnxt_ransack.
|
45
|
+
Please update you Gemfile.
|
45
46
|
rdoc_options: []
|
46
47
|
require_paths:
|
47
48
|
- lib
|