bolter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bolter/sortable.rb +3 -3
- data/lib/bolter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6e7447428e048162fffb71c8feb92c6d537e40c
|
4
|
+
data.tar.gz: 008034a83b59cf18a0a8be75f9e7c6209da7734d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2134b161ad6dac22e4bbcb487facd68fa9e0d9994a55f3e83fa7cdede4e1c7651a402d16bfdcfe4a825aace466881f2722ec7b4f8aeb8aab136d3c1671c9a66a
|
7
|
+
data.tar.gz: a300c1ff681d3c221c2ec2092e8ea10ad360e5448c3224d0cda6e5ae5eaa385d59474fd0ec9f93d571d3ab4e66503751de9d59196d2edd247c59e1dc06caec25
|
data/lib/bolter/sortable.rb
CHANGED
@@ -3,14 +3,14 @@ module Bolter
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
included do
|
5
5
|
def self.sorting(sorting = nil)
|
6
|
-
return self unless sorting
|
6
|
+
return self.order({}) unless sorting
|
7
7
|
field, direction = sorting.split(':',2)
|
8
8
|
if self.attribute_names.include? field.to_s
|
9
9
|
if %W[asc desc].include? direction
|
10
|
-
return self.
|
10
|
+
return self.reorder(Hash[field, direction])
|
11
11
|
end
|
12
12
|
else
|
13
|
-
self
|
13
|
+
self.order({})
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/bolter/version.rb
CHANGED