mobility-ransack 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/mobility/plugins/ransack.rb +7 -10
- data/lib/mobility/ransack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8670adaf2e4015f22013bf1d603776546dfb056d07625774a42428ca6ff93bf
|
4
|
+
data.tar.gz: 9557bd4173de477dfb69c19b9afff15539f5e35560f4fb5121ab611a42d84933
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cedfe486eec3ab47c0d43c5d6a8b4bbf0d55cdb7c04f870d1b869935138be83bad7ac095dea932499b9200bb90598657dd3fc1e6a6c1faae008de972d04fc25
|
7
|
+
data.tar.gz: '081afba246bc2d12c9ae989bff5df3f5305b90b15f20ecfd3610a35aa6bec8dfb1f50b821d7663b91a5210922b5bacfc4dfa7b2d9d9f987050eaf1b382ea2d3d'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## 0.2
|
4
4
|
|
5
|
+
### 0.2.1
|
6
|
+
- Extend ransack search with module
|
7
|
+
([#4](https://github.com/shioyama/mobility-ransack/pull/4))
|
8
|
+
- Refactor `Mobility::Plugins::Ransack.apply`
|
9
|
+
([#3](https://github.com/shioyama/mobility-ransack/pull/3))
|
10
|
+
|
5
11
|
### 0.2.0
|
6
12
|
|
7
13
|
- Support sorting on translated attributes
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,8 @@ Mobility Ransack
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/mobility-ransack.svg)][gem]
|
5
5
|
[![Build Status](https://travis-ci.org/shioyama/mobility-ransack.svg?branch=master)][travis]
|
6
6
|
|
7
|
-
[gem]: https://rubygems.org/gems/
|
8
|
-
[travis]: https://travis-ci.org/shioyama/
|
7
|
+
[gem]: https://rubygems.org/gems/mobility-ransack
|
8
|
+
[travis]: https://travis-ci.org/shioyama/mobility-ransack
|
9
9
|
|
10
10
|
Search on translated attributes with
|
11
11
|
[Mobility](https://github.com/shioyama/mobility) and
|
@@ -16,7 +16,7 @@ Search on translated attributes with
|
|
16
16
|
Just add the gem to your Gemfile:
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
gem 'mobility-ransack', '~> 0.2.
|
19
|
+
gem 'mobility-ransack', '~> 0.2.1'
|
20
20
|
```
|
21
21
|
|
22
22
|
Now enable the `ransack` plugin in Mobility's configuration so that it can be
|
@@ -9,22 +9,19 @@ module Mobility
|
|
9
9
|
# @param [Boolean] option
|
10
10
|
def self.apply(attributes, option)
|
11
11
|
if option
|
12
|
-
backend_class = attributes.backend_class
|
13
|
-
|
14
|
-
|
15
|
-
attributes.each do |attr|
|
16
|
-
ransacker(attr) { backend_class.build_node(attr, Mobility.locale) }
|
17
|
-
end
|
18
|
-
extend plugin
|
12
|
+
backend_class, model_class = attributes.backend_class, attributes.model_class
|
13
|
+
attributes.each do |attr|
|
14
|
+
model_class.ransacker(attr) { backend_class.build_node(attr, Mobility.locale) }
|
19
15
|
end
|
16
|
+
model_class.extend self
|
20
17
|
end
|
21
18
|
end
|
22
19
|
|
23
|
-
def ransack(
|
24
|
-
|
20
|
+
def ransack(*)
|
21
|
+
super.extend(Search)
|
25
22
|
end
|
26
23
|
|
27
|
-
|
24
|
+
module Search
|
28
25
|
def result(opts = {})
|
29
26
|
sorted = sorts.inject(super) do |relation, sort|
|
30
27
|
predicate = ::Ransack::Visitor.new.visit_Ransack_Nodes_Sort(sort)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobility-ransack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Salzberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ransack
|