simple_form_ransack 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7503aa043a1137a17d483feb14508f2e3ed272b
|
4
|
+
data.tar.gz: f4d9499bac8ea5bfb29bf7bce45c0069344f4c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc144ad51d2757b536d930c71c31ee80fc3122e31ee89d4d9d64c1dea73857158931d1388226678691f78496cdc98138bc2e68febd468a7b29969e6569349674
|
7
|
+
data.tar.gz: 400993d49561a440c86d426293282d40493a30d3c60f5d226c22ff379ff06c5e6aee8fff1345201459e34df4f1bf159b7df2a5db1e34599d53648fb3fe791f81
|
@@ -1,11 +1,16 @@
|
|
1
1
|
class SimpleFormRansack::FormProxy
|
2
2
|
def self.predicates_regex
|
3
3
|
unless @predicates_regex
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
if Object.const_defined?(:Ransack)
|
5
|
+
predicates = Ransack::Configuration
|
6
|
+
.predicates
|
7
|
+
.map(&:first)
|
8
|
+
.map { |predicate| Regexp.escape(predicate) }
|
9
|
+
.join("|")
|
10
|
+
else
|
11
|
+
# BazaModels support
|
12
|
+
predicates = "cont|eq|gteq|lteq|gt|lt|eq_any"
|
13
|
+
end
|
9
14
|
|
10
15
|
@predicates_regex = /^(.+)_(#{predicates})$/
|
11
16
|
end
|
@@ -15,7 +20,6 @@ class SimpleFormRansack::FormProxy
|
|
15
20
|
|
16
21
|
def initialize(args)
|
17
22
|
@ransack = args.fetch(:ransack)
|
18
|
-
@object = @ransack.object
|
19
23
|
@class = @ransack.klass
|
20
24
|
@params = args.fetch(:params)
|
21
25
|
@form = args.fetch(:form)
|
@@ -1,11 +1,18 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require "ransack"
|
3
|
+
ransack_loaded = true
|
4
|
+
rescue LoadError
|
5
|
+
ransack_loaded = false
|
6
|
+
end
|
2
7
|
|
3
|
-
|
4
|
-
|
5
|
-
|
8
|
+
if ransack_loaded
|
9
|
+
# This saves the params given to Ransack, so they can be recalled later
|
10
|
+
class Ransack::Search
|
11
|
+
alias old_build build
|
6
12
|
|
7
|
-
|
8
|
-
|
9
|
-
|
13
|
+
def build(params = {})
|
14
|
+
@_registered_params = params
|
15
|
+
old_build(params)
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
219
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.2.2
|
221
221
|
signing_key:
|
222
222
|
specification_version: 4
|
223
223
|
summary: Ransack and SimpleForm combined.
|