sortable-by 0.8.0 → 0.9.0
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 +4 -4
- data/.travis.yml +2 -0
- data/Gemfile.lock +29 -32
- data/README.md +3 -3
- data/lib/sortable_by.rb +1 -1
- data/sortable-by.gemspec +1 -1
- data/spec/sortable_by_spec.rb +9 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c69dc4027db827d7339df15f6b6a82a00dd106c3
|
4
|
+
data.tar.gz: 6542aa11412834bd4360db4f6f989e2fb56358de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12165f68bf353d543f8701ed328586822a8c43d729cd514b8695821214a424926507e53e0fb443639a2051e28626733e6edcb47a5f5530949ae9bd6e9e80aa0a
|
7
|
+
data.tar.gz: 9008ae98a2a8aacb2bf807b9db1eb428fc6934e39e84ae11369919f46cbe75463c3e63ceb3897f88819cd5b125071c47591290bb0c2d33f950114c0966cd2219
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,48 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sortable-by (0.
|
4
|
+
sortable-by (0.9.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
activemodel (5.0.1)
|
12
|
+
activesupport (= 5.0.1)
|
13
|
+
activerecord (5.0.1)
|
14
|
+
activemodel (= 5.0.1)
|
15
|
+
activesupport (= 5.0.1)
|
16
|
+
arel (~> 7.0)
|
17
|
+
activesupport (5.0.1)
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (~> 0.7)
|
20
|
-
json (~> 1.7, >= 1.7.7)
|
21
20
|
minitest (~> 5.1)
|
22
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
23
21
|
tzinfo (~> 1.1)
|
24
|
-
arel (
|
25
|
-
|
26
|
-
diff-lcs (1.
|
27
|
-
i18n (0.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
rspec-
|
33
|
-
rspec-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rspec-expectations (3.3.1)
|
22
|
+
arel (7.1.4)
|
23
|
+
concurrent-ruby (1.0.4)
|
24
|
+
diff-lcs (1.3)
|
25
|
+
i18n (0.8.1)
|
26
|
+
minitest (5.10.1)
|
27
|
+
rake (12.0.0)
|
28
|
+
rspec (3.5.0)
|
29
|
+
rspec-core (~> 3.5.0)
|
30
|
+
rspec-expectations (~> 3.5.0)
|
31
|
+
rspec-mocks (~> 3.5.0)
|
32
|
+
rspec-core (3.5.4)
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-expectations (3.5.0)
|
38
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-mocks (3.
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-mocks (3.5.0)
|
41
38
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-support (3.
|
44
|
-
sqlite3 (1.3.
|
45
|
-
thread_safe (0.3.
|
39
|
+
rspec-support (~> 3.5.0)
|
40
|
+
rspec-support (3.5.0)
|
41
|
+
sqlite3 (1.3.13)
|
42
|
+
thread_safe (0.3.6)
|
46
43
|
tzinfo (1.2.2)
|
47
44
|
thread_safe (~> 0.1)
|
48
45
|
|
@@ -57,4 +54,4 @@ DEPENDENCIES
|
|
57
54
|
sqlite3
|
58
55
|
|
59
56
|
BUNDLED WITH
|
60
|
-
1.
|
57
|
+
1.14.3
|
data/README.md
CHANGED
@@ -17,9 +17,9 @@ class Foo < ActiveRecord::Base
|
|
17
17
|
sortable_by :title, :updated_at, default: { updated_at: :desc }
|
18
18
|
end
|
19
19
|
|
20
|
-
Foo.
|
21
|
-
Foo.
|
22
|
-
Foo.
|
20
|
+
Foo.sorted_by "-updated_at,title" # => ORDER BY updated_at DESC, title ASC
|
21
|
+
Foo.sorted_by "bad,title" # => ORDER BY title ASC
|
22
|
+
Foo.sorted_by nil # => ORDER BY updated_at DESC
|
23
23
|
```
|
24
24
|
|
25
25
|
## LICENCE
|
data/lib/sortable_by.rb
CHANGED
data/sortable-by.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'sortable-by'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '0.9.0'
|
5
5
|
s.authors = ['Dimitrij Denissenko']
|
6
6
|
s.email = ['dimitrij@blacksquaremedia.com']
|
7
7
|
s.summary = 'Generate white-listed sort scopes from URL parameter values'
|
data/spec/sortable_by_spec.rb
CHANGED
@@ -8,15 +8,16 @@ describe ActiveRecord::SortableByHelper do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should generate scopes' do
|
11
|
-
expect(Foo.
|
12
|
-
expect(Foo.
|
13
|
-
expect(Foo.
|
14
|
-
expect(Foo.
|
15
|
-
expect(Foo.
|
16
|
-
expect(Foo.
|
11
|
+
expect(Foo.sorted_by("title").pluck(:title)).to eq(["A", "B", "B", "C"])
|
12
|
+
expect(Foo.sorted_by("-title").pluck(:title)).to eq(["C", "B", "B", "A"])
|
13
|
+
expect(Foo.sorted_by("age,title").pluck(:title)).to eq(["B", "A", "B", "C"])
|
14
|
+
expect(Foo.sorted_by("invalid , -age").pluck(:title)).to eq(["C", "B", "A", "B"])
|
15
|
+
expect(Foo.sorted_by("").pluck(:title)).to eq(["A", "B", "B", "C"])
|
16
|
+
expect(Foo.sorted_by(nil).pluck(:title)).to eq(["A", "B", "B", "C"])
|
17
17
|
|
18
|
-
expect(Bar.
|
19
|
-
expect(Bar.
|
18
|
+
expect(Bar.sorted_by("").pluck(:title)).to eq(["Y", "X"])
|
19
|
+
expect(Bar.sorted_by("title").pluck(:title)).to eq(["Y", "X"])
|
20
|
+
expect(Bar.where(title: "X").sorted_by("title").pluck(:title)).to eq(["X"])
|
20
21
|
end
|
21
22
|
|
22
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sortable-by
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.6.8
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Generate white-listed sort scopes from URL parameter values
|