sortable-by 0.9.0 → 0.10.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 +5 -5
- data/.rubocop.yml +18 -0
- data/.travis.yml +5 -5
- data/Gemfile +1 -1
- data/Gemfile.lock +43 -26
- data/LICENSE +20 -0
- data/README.md +27 -25
- data/Rakefile +3 -0
- data/lib/sortable_by.rb +67 -13
- data/sortable-by.gemspec +6 -5
- data/spec/sortable_by_spec.rb +18 -13
- data/spec/spec_helper.rb +20 -7
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5b5117bc573fa2cf18ccee9dec86c53cd09920af83463e161ad97c34a50c87c4
|
4
|
+
data.tar.gz: 47bed91f217dfc04a5d9180040a18a163e0f2da6597059bb73ce8390c01d5d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68712cabc1e8d2bc54d4716d27cd896170fad207448814a0c784f7a018bd2da8b0fad7d26ba1cfca8cb884969665f014c3aa0912c457fbb2465a1fa4c7214c5c
|
7
|
+
data.tar.gz: 9d9b0f42b50c94cbcd36eec6cb2b1c1367150943a6c252092d84d45b3aecdb5ea1431ff227faa68db045b32fc02983f4d0bcb41fa1619a9f28d4a1ffd1789666
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.2
|
3
|
+
|
4
|
+
Metrics/AbcSize:
|
5
|
+
Enabled: false
|
6
|
+
Naming/FileName:
|
7
|
+
Exclude: [lib/sortable-by.rb]
|
8
|
+
Metrics/MethodLength:
|
9
|
+
Max: 20
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 120
|
12
|
+
|
13
|
+
Style/TrailingCommaInArguments:
|
14
|
+
EnforcedStyleForMultiline: consistent_comma
|
15
|
+
Style/TrailingCommaInArrayLiteral:
|
16
|
+
EnforcedStyleForMultiline: consistent_comma
|
17
|
+
Style/TrailingCommaInHashLiteral:
|
18
|
+
EnforcedStyleForMultiline: consistent_comma
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,47 +1,63 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sortable-by (0.
|
4
|
+
sortable-by (0.10.0)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (5.
|
12
|
-
activesupport (= 5.
|
13
|
-
activerecord (5.
|
14
|
-
activemodel (= 5.
|
15
|
-
activesupport (= 5.
|
16
|
-
arel (~>
|
17
|
-
activesupport (5.
|
11
|
+
activemodel (5.1.5)
|
12
|
+
activesupport (= 5.1.5)
|
13
|
+
activerecord (5.1.5)
|
14
|
+
activemodel (= 5.1.5)
|
15
|
+
activesupport (= 5.1.5)
|
16
|
+
arel (~> 8.0)
|
17
|
+
activesupport (5.1.5)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (~> 0.7)
|
20
20
|
minitest (~> 5.1)
|
21
21
|
tzinfo (~> 1.1)
|
22
|
-
arel (
|
23
|
-
|
22
|
+
arel (8.0.0)
|
23
|
+
ast (2.4.0)
|
24
|
+
concurrent-ruby (1.0.5)
|
24
25
|
diff-lcs (1.3)
|
25
|
-
i18n (0.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rspec
|
26
|
+
i18n (0.9.5)
|
27
|
+
concurrent-ruby (~> 1.0)
|
28
|
+
minitest (5.11.3)
|
29
|
+
parallel (1.12.1)
|
30
|
+
parser (2.5.0.4)
|
31
|
+
ast (~> 2.4.0)
|
32
|
+
powerpack (0.1.1)
|
33
|
+
rainbow (3.0.0)
|
34
|
+
rake (12.3.0)
|
35
|
+
rspec (3.7.0)
|
36
|
+
rspec-core (~> 3.7.0)
|
37
|
+
rspec-expectations (~> 3.7.0)
|
38
|
+
rspec-mocks (~> 3.7.0)
|
39
|
+
rspec-core (3.7.1)
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-expectations (3.7.0)
|
35
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.
|
37
|
-
rspec-mocks (3.
|
43
|
+
rspec-support (~> 3.7.0)
|
44
|
+
rspec-mocks (3.7.0)
|
38
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.
|
40
|
-
rspec-support (3.
|
46
|
+
rspec-support (~> 3.7.0)
|
47
|
+
rspec-support (3.7.1)
|
48
|
+
rubocop (0.53.0)
|
49
|
+
parallel (~> 1.10)
|
50
|
+
parser (>= 2.5)
|
51
|
+
powerpack (~> 0.1)
|
52
|
+
rainbow (>= 2.2.2, < 4.0)
|
53
|
+
ruby-progressbar (~> 1.7)
|
54
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
55
|
+
ruby-progressbar (1.9.0)
|
41
56
|
sqlite3 (1.3.13)
|
42
57
|
thread_safe (0.3.6)
|
43
|
-
tzinfo (1.2.
|
58
|
+
tzinfo (1.2.5)
|
44
59
|
thread_safe (~> 0.1)
|
60
|
+
unicode-display_width (1.3.0)
|
45
61
|
|
46
62
|
PLATFORMS
|
47
63
|
ruby
|
@@ -50,8 +66,9 @@ DEPENDENCIES
|
|
50
66
|
bundler
|
51
67
|
rake
|
52
68
|
rspec
|
69
|
+
rubocop
|
53
70
|
sortable-by!
|
54
71
|
sqlite3
|
55
72
|
|
56
73
|
BUNDLED WITH
|
57
|
-
1.
|
74
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015-2018 Black Square Media
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Sortable By
|
2
2
|
|
3
|
+
[](https://travis-ci.org/bsm/sortable-by)
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
5
|
+
|
3
6
|
ActiveRecord plugin to parse the sort order from a query parameter, match against a white-list and generate a scope. Useful for [JSON-API][jsonapi] compatibility.
|
4
7
|
|
5
8
|
[jsonapi]: http://jsonapi.org/format/#fetching-sorting
|
@@ -10,39 +13,38 @@ Add `gem 'sortable-by'` to your Gemfile.
|
|
10
13
|
|
11
14
|
## Usage
|
12
15
|
|
13
|
-
Simple use
|
16
|
+
Simple use case:
|
14
17
|
|
15
18
|
```ruby
|
16
19
|
class Foo < ActiveRecord::Base
|
17
20
|
sortable_by :title, :updated_at, default: { updated_at: :desc }
|
18
21
|
end
|
19
22
|
|
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
|
+
Foo.sorted_by "-updated_at,title" # => ORDER BY foos.updated_at DESC, foos.title ASC
|
24
|
+
Foo.sorted_by "bad,title" # => ORDER BY foos.title ASC
|
25
|
+
Foo.sorted_by nil # => ORDER BY foos.updated_at DESC
|
23
26
|
```
|
24
27
|
|
25
|
-
|
28
|
+
Aliases and composition:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
class Foo < ActiveRecord::Base
|
32
|
+
sortable_by semver: %i[major minor patch], default: { id: :asc }
|
33
|
+
end
|
26
34
|
|
35
|
+
Foo.sorted_by "semver" # => ORDER BY foos.major ASC, foos.minor ASC, foos.patch ASC
|
36
|
+
Foo.sorted_by "-semver" # => ORDER BY foos.major DESC, foos.minor DESC, foos.patch DESC
|
37
|
+
Foo.sorted_by nil # => ORDER BY foos.id ASC
|
27
38
|
```
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
included in all copies or substantial portions of the Software.
|
40
|
-
|
41
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
42
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
43
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
44
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
45
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
46
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
47
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
39
|
+
|
40
|
+
Custom functions:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
class Foo < ActiveRecord::Base
|
44
|
+
sortable_by insensitive: Arel::Nodes::NamedFunction.new('LOWER', [arel_table[:title]]), default: { id: :asc }
|
45
|
+
end
|
46
|
+
|
47
|
+
Foo.sorted_by "insensitive" # => ORDER BY LOWER(foos.title) ASC
|
48
|
+
Foo.sorted_by "-insensitive" # => ORDER BY LOWER(foos.title) DESC
|
49
|
+
Foo.sorted_by nil # => ORDER BY foos.id ASC
|
48
50
|
```
|
data/Rakefile
CHANGED
data/lib/sortable_by.rb
CHANGED
@@ -2,8 +2,8 @@ require 'active_record'
|
|
2
2
|
require 'active_support/concern'
|
3
3
|
require 'set'
|
4
4
|
|
5
|
-
module ActiveRecord
|
6
|
-
module SortableByHelper
|
5
|
+
module ActiveRecord # :nodoc:
|
6
|
+
module SortableByHelper # :nodoc:
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
included do
|
@@ -11,32 +11,86 @@ module ActiveRecord
|
|
11
11
|
sortable_by
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
def self.validate_custom_scope!(custom, original = custom)
|
15
|
+
case custom
|
16
|
+
when true, Arel::Nodes::Node, String, Symbol
|
17
|
+
nil # OK
|
18
|
+
when Array
|
19
|
+
custom.each do |v|
|
20
|
+
validate_custom_scope!(v, original)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
raise ArgumentError, "Option #{original.inspect} contains unexpected values."
|
24
|
+
end
|
25
|
+
end
|
15
26
|
|
27
|
+
def self.order_clause(name, rank, value)
|
28
|
+
case value
|
29
|
+
when true
|
30
|
+
{ name => rank }
|
31
|
+
when String, Symbol
|
32
|
+
{ value => rank }
|
33
|
+
when Arel::Nodes::Node
|
34
|
+
value.send(rank)
|
35
|
+
when Array
|
36
|
+
value.map { |v| order_clause(name, rank, v) }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module ClassMethods # :nodoc:
|
41
|
+
# Copy _sortable_by_scope_options on inheritance.
|
42
|
+
def inherited(base) #:nodoc:
|
43
|
+
base._sortable_by_scope_options = _sortable_by_scope_options.deep_dup
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
# Provide a whitelist and options for sorted_by
|
16
48
|
def sortable_by(*whitelist)
|
49
|
+
self._sortable_by_scope_options ||= { scopes: {}, default: { id: :asc } }
|
50
|
+
|
17
51
|
opts = whitelist.extract_options!
|
18
|
-
|
19
|
-
self._sortable_by_scope_options =
|
52
|
+
default = opts.delete(:default)
|
53
|
+
self._sortable_by_scope_options[:default] = default if default
|
54
|
+
|
55
|
+
whitelist.each do |attr|
|
56
|
+
self._sortable_by_scope_options[:scopes][attr.to_s] = true
|
57
|
+
end
|
58
|
+
opts.each do |attr, custom|
|
59
|
+
SortableByHelper.validate_custom_scope!(custom)
|
60
|
+
self._sortable_by_scope_options[:scopes][attr.to_s] = custom
|
61
|
+
end
|
20
62
|
end
|
21
63
|
|
22
64
|
# @param [String] expr the sort expr
|
23
65
|
# @return [ActiveRecord::Relation] the scoped relation
|
24
66
|
def sorted_by(expr)
|
25
|
-
|
26
|
-
expr.to_s.split(',').
|
67
|
+
relation = self
|
68
|
+
matches = expr.to_s.split(',').count do |name|
|
27
69
|
name.strip!
|
70
|
+
|
28
71
|
rank = :asc
|
29
|
-
|
30
|
-
|
72
|
+
if name[0] == '-'
|
73
|
+
rank = :desc
|
74
|
+
name = name[1..-1]
|
75
|
+
end
|
76
|
+
|
77
|
+
value = self._sortable_by_scope_options[:scopes][name]
|
78
|
+
clause = SortableByHelper.order_clause(name, rank, value)
|
79
|
+
relation = relation.order(clause) if clause
|
80
|
+
clause
|
81
|
+
end
|
82
|
+
|
83
|
+
if matches.zero?
|
84
|
+
default = self._sortable_by_scope_options[:default]
|
85
|
+
relation = relation.order(default)
|
31
86
|
end
|
32
|
-
options = self._sortable_by_scope_options[:default] if options.empty?
|
33
|
-
order(options)
|
34
|
-
end
|
35
87
|
|
88
|
+
relation
|
89
|
+
end
|
36
90
|
end
|
37
91
|
end
|
38
92
|
|
39
|
-
class Base
|
93
|
+
class Base # :nodoc:
|
40
94
|
include SortableByHelper
|
41
95
|
end
|
42
96
|
end
|
data/sortable-by.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'sortable-by'
|
4
|
-
s.version = '0.
|
4
|
+
s.version = '0.10.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'
|
@@ -9,16 +9,17 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'https://github.com/bsm/sortable-by'
|
10
10
|
s.license = 'MIT'
|
11
11
|
|
12
|
-
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
12
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
|
13
13
|
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
14
14
|
s.require_paths = ['lib']
|
15
|
-
s.required_ruby_version = '>=
|
15
|
+
s.required_ruby_version = '>= 2.2.0'
|
16
16
|
|
17
|
-
s.add_dependency 'activesupport'
|
18
17
|
s.add_dependency 'activerecord'
|
18
|
+
s.add_dependency 'activesupport'
|
19
19
|
|
20
20
|
s.add_development_dependency 'bundler'
|
21
21
|
s.add_development_dependency 'rake'
|
22
22
|
s.add_development_dependency 'rspec'
|
23
|
+
s.add_development_dependency 'rubocop'
|
23
24
|
s.add_development_dependency 'sqlite3'
|
24
25
|
end
|
data/spec/sortable_by_spec.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
3
|
describe ActiveRecord::SortableByHelper do
|
4
|
-
|
5
4
|
it 'should have config' do
|
6
|
-
expect(Foo._sortable_by_scope_options).to
|
7
|
-
expect(
|
5
|
+
expect(Foo._sortable_by_scope_options).to include(:default, :scopes)
|
6
|
+
expect(Foo._sortable_by_scope_options[:default]).to eq(title: :asc)
|
7
|
+
expect(Foo._sortable_by_scope_options[:scopes]).to be_instance_of(Hash)
|
8
|
+
expect(Foo._sortable_by_scope_options[:scopes]).to include('title', 'age', 'semver', 'insensitive')
|
9
|
+
expect(Bar._sortable_by_scope_options).to eq(default: { id: :asc }, scopes: {})
|
8
10
|
end
|
9
11
|
|
10
12
|
it 'should generate scopes' do
|
11
|
-
expect(Foo.sorted_by(
|
12
|
-
expect(Foo.sorted_by(
|
13
|
-
expect(Foo.sorted_by(
|
14
|
-
expect(Foo.sorted_by(
|
15
|
-
expect(Foo.sorted_by(
|
16
|
-
expect(Foo.sorted_by(
|
13
|
+
expect(Foo.sorted_by('title').pluck(:title)).to eq(%w[A B C b])
|
14
|
+
expect(Foo.sorted_by('-title').pluck(:title)).to eq(%w[b C B A])
|
15
|
+
expect(Foo.sorted_by('age,title').pluck(:title)).to eq(%w[B A b C])
|
16
|
+
expect(Foo.sorted_by('invalid , -age').pluck(:title)).to eq(%w[C b A B])
|
17
|
+
expect(Foo.sorted_by('insensitive,age').pluck(:title)).to eq(%w[A B b C])
|
18
|
+
expect(Foo.sorted_by('-insensitive,age').pluck(:title)).to eq(%w[C B b A])
|
19
|
+
expect(Foo.sorted_by('semver').pluck(:title)).to eq(%w[b B C A])
|
20
|
+
expect(Foo.sorted_by('-semver').pluck(:title)).to eq(%w[A C B b])
|
21
|
+
expect(Foo.sorted_by('').pluck(:title)).to eq(%w[A B C b])
|
22
|
+
expect(Foo.sorted_by(nil).pluck(:title)).to eq(%w[A B C b])
|
17
23
|
|
18
|
-
expect(Bar.sorted_by(
|
19
|
-
expect(Bar.sorted_by(
|
20
|
-
expect(Bar.where(title:
|
24
|
+
expect(Bar.sorted_by('').pluck(:title)).to eq(%w[Y X])
|
25
|
+
expect(Bar.sorted_by('title').pluck(:title)).to eq(%w[Y X])
|
26
|
+
expect(Bar.where(title: 'X').sorted_by('title').pluck(:title)).to eq(%w[X])
|
21
27
|
end
|
22
|
-
|
23
28
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,29 +1,42 @@
|
|
1
|
-
ENV['RACK_ENV'] ||=
|
1
|
+
ENV['RACK_ENV'] ||= 'test'
|
2
2
|
require 'sortable-by'
|
3
3
|
require 'rspec'
|
4
4
|
|
5
|
-
ActiveRecord::Base.configurations[
|
5
|
+
ActiveRecord::Base.configurations['test'] = {
|
6
|
+
'adapter' => 'sqlite3',
|
7
|
+
'database' => ':memory:',
|
8
|
+
}
|
6
9
|
ActiveRecord::Base.establish_connection :test
|
7
10
|
ActiveRecord::Base.connection.create_table :foos do |t|
|
8
11
|
t.string :title
|
9
12
|
t.integer :age
|
13
|
+
|
14
|
+
t.integer :major
|
15
|
+
t.integer :minor
|
10
16
|
end
|
11
17
|
|
12
18
|
ActiveRecord::Base.connection.create_table :bars do |t|
|
13
19
|
t.string :title
|
14
20
|
end
|
15
21
|
|
22
|
+
ActiveRecord::Base.connection.create_table :boos do |t|
|
23
|
+
t.string :title
|
24
|
+
end
|
25
|
+
|
16
26
|
class Foo < ActiveRecord::Base
|
17
|
-
sortable_by :title, :age,
|
27
|
+
sortable_by :title, :age,
|
28
|
+
insensitive: Arel::Nodes::NamedFunction.new('LOWER', [arel_table[:title]]),
|
29
|
+
semver: %i[major minor],
|
30
|
+
default: { title: :asc }
|
18
31
|
end
|
19
32
|
|
20
33
|
class Bar < ActiveRecord::Base
|
21
34
|
end
|
22
35
|
|
23
|
-
Foo.create! title: 'A', age: 25
|
24
|
-
Foo.create! title: 'B', age: 24
|
25
|
-
Foo.create! title: '
|
26
|
-
Foo.create! title: 'C', age: 27
|
36
|
+
Foo.create! title: 'A', age: 25, major: 10, minor: 1
|
37
|
+
Foo.create! title: 'B', age: 24, major: 8, minor: 3
|
38
|
+
Foo.create! title: 'b', age: 26, major: 0, minor: 2
|
39
|
+
Foo.create! title: 'C', age: 27, major: 8, minor: 6
|
27
40
|
|
28
41
|
Bar.create! title: 'Y'
|
29
42
|
Bar.create! title: 'X'
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sortable-by
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.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: 2018-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: sqlite3
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,9 +116,11 @@ extensions: []
|
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
104
118
|
- ".gitignore"
|
119
|
+
- ".rubocop.yml"
|
105
120
|
- ".travis.yml"
|
106
121
|
- Gemfile
|
107
122
|
- Gemfile.lock
|
123
|
+
- LICENSE
|
108
124
|
- README.md
|
109
125
|
- Rakefile
|
110
126
|
- lib/sortable-by.rb
|
@@ -124,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
140
|
requirements:
|
125
141
|
- - ">="
|
126
142
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
143
|
+
version: 2.2.0
|
128
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
145
|
requirements:
|
130
146
|
- - ">="
|
@@ -132,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
148
|
version: '0'
|
133
149
|
requirements: []
|
134
150
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.7.3
|
136
152
|
signing_key:
|
137
153
|
specification_version: 4
|
138
154
|
summary: Generate white-listed sort scopes from URL parameter values
|