activesorting 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/README.md +1 -1
- data/lib/active_sorting/model.rb +5 -5
- data/lib/active_sorting/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7581f100b1a9767cbf2c3d518b0c2b6610c63ff1
|
4
|
+
data.tar.gz: 1a8d949fe9631719b65c4161d402c583c6930f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7fb853507a2ff0bfdfeab35dd7394d6ca81cc312350763b92f45938bf85f5d6fe4c517137516ccea34b493426be09b79b7a61c941301af96dfaaee5937c074b
|
7
|
+
data.tar.gz: 23aeea21e2c9fcf789d1a6814f0568ec9ef2ceb1965ef3bbc05c9d99adf7f8b1e1ec8b1f94db58f070f3a18589ce442889085d9bbe083053f0b247f5387fde7b
|
data/.coveralls.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
repo_token:
|
1
|
+
repo_token: lXd99dk7JUU0xk4RI63RJLYzYPqjZONgE
|
data/README.md
CHANGED
data/lib/active_sorting/model.rb
CHANGED
@@ -2,13 +2,12 @@ module ActiveSorting
|
|
2
2
|
module Model # :nodoc:
|
3
3
|
def self.included(base)
|
4
4
|
base.extend ClassMethods
|
5
|
+
# Track all sortable arguments
|
6
|
+
base.class_attribute :active_sorting_options
|
5
7
|
end
|
6
8
|
|
7
9
|
# Patches ActiveRecord models
|
8
10
|
module ClassMethods
|
9
|
-
# Track all sortable arguments
|
10
|
-
attr_accessor :active_sorting_options
|
11
|
-
|
12
11
|
# Sets the sortable options
|
13
12
|
#
|
14
13
|
# +name+ sortable field name
|
@@ -35,8 +34,9 @@ module ActiveSorting
|
|
35
34
|
|
36
35
|
# Check provided options
|
37
36
|
def active_sorting_check_options
|
38
|
-
|
39
|
-
|
37
|
+
field_type = columns_hash[active_sorting_field.to_s].type
|
38
|
+
unless field_type == :integer
|
39
|
+
raise ArgumentError, "Sortable field should be of type Integer, #{field_type} given"
|
40
40
|
end
|
41
41
|
unless active_sorting_step.is_a?(Fixnum)
|
42
42
|
raise ArgumentError, 'Sortable step should be of type Fixnum'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesorting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Omar Abdel-Wahab
|
@@ -181,3 +181,4 @@ signing_key:
|
|
181
181
|
specification_version: 4
|
182
182
|
summary: Adds ability to sort models using a custom field
|
183
183
|
test_files: []
|
184
|
+
has_rdoc:
|