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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b666246ec54369683b3ca4c47ab7a37b276b8f6edd105dbfe001438dc8946b63
4
- data.tar.gz: 2c6bc9c9703f0a1a14f6eea1ca53bd1098b685d4964e8f2ba926ed801e95de67
3
+ metadata.gz: b8670adaf2e4015f22013bf1d603776546dfb056d07625774a42428ca6ff93bf
4
+ data.tar.gz: 9557bd4173de477dfb69c19b9afff15539f5e35560f4fb5121ab611a42d84933
5
5
  SHA512:
6
- metadata.gz: 294f956b8dbbfee07354f44f6fd3a27f58f234d274e7361501adb84472c59918f4e133641d140d1e71f0f20e6584af4b961a649d84523737ed1aa3916ccdc408
7
- data.tar.gz: 931b32c4430f2623434012710b6436245ddabe1b7522d6b1f703a0038ae7b18d5382daf563a260a77b18d1dbfd3df72d75bd4ea1ae24b0e5a7d737d64eacadf9
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mobility-ransack (0.1.1)
4
+ mobility-ransack (0.2.1)
5
5
  mobility (~> 0.8.0)
6
6
  ransack (>= 1.8.0, < 2.1)
7
7
 
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/friendly_id-mobility
8
- [travis]: https://travis-ci.org/shioyama/friendly_id-mobility
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.0'
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
- plugin = self
14
- attributes.model_class.class_eval do
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(params = {}, options = {})
24
- Search.new(self, params, options)
20
+ def ransack(*)
21
+ super.extend(Search)
25
22
  end
26
23
 
27
- class Search < ::Ransack::Search
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)
@@ -1,5 +1,5 @@
1
1
  module Mobility
2
2
  module Ransack
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
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.0
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-12 00:00:00.000000000 Z
11
+ date: 2018-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ransack