active_record_sorting 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b0efa3c2c9fab95170e8bf7537bc3bb8bc4b140
4
- data.tar.gz: f301b09466d7025f72c0f58679d6dfbcdb5b78f0
3
+ metadata.gz: 84f596dad462acbea2df207029d6141362a77415
4
+ data.tar.gz: d4b047c510f568b6d3e15446005fda22d2156e6c
5
5
  SHA512:
6
- metadata.gz: 7b1afc2ed2fc414adc4bf723f80128966510583d097820972a6e16aa14a77e6cf8dc376107e42d1106d889b6571099696a49698a6405b07b7b0798605ae57e88
7
- data.tar.gz: f2d054dec6857fdaa0b595c164f709575d409c4b6f7c52af872a474ae7ed1b0e9d8659d70de863bf16704317643830894d55dabefbb3020abd3a821c667bdaaf
6
+ metadata.gz: 19e28b6a9d37b4c9f73a3630d5fca53bb56cc93dbc954b1ff31d840ebc584885749ea1508266047967aa75dbcdc1998cfdb01c8d38ebd53b82c734afa6cba84c
7
+ data.tar.gz: e86ab3ee732a632f7f4eadb9db4837821d78eea57e7d81d15ed24961de355d840376189c993da662397d9b9f08ac20751e50d9368b295274032ed76705455f69
@@ -6,8 +6,8 @@ module ActiveRecordSorting
6
6
 
7
7
  included do
8
8
  def self.sort(order)
9
- klass = "#{self.name}Sorting".constantize rescue ActiveRecordSorting::Base
10
- klass.new(self).sort(order)
9
+ klass = "#{self}Sorting".constantize rescue ActiveRecordSorting::Base
10
+ klass.new(where(nil)).sort(order)
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordSorting
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -21,6 +21,15 @@ describe ActiveRecordSorting::Concern do
21
21
  end
22
22
  end
23
23
 
24
+ context 'use scopes' do
25
+ subject { Group.where(name: 'Lorem') }
26
+ let(:sorting_class) { ActiveRecordSorting::Base }
27
+
28
+ it 'should delegate sorting to base sorting class' do
29
+ expected_to_sort_with 'name_asc', sorting_class
30
+ end
31
+ end
32
+
24
33
  private
25
34
 
26
35
  def expected_to_sort_with(order, sorting_class)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_sorting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - yratanov