activekit 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/active_kit/position/harmonize.rb +2 -2
- data/lib/active_kit/position/positioner.rb +1 -1
- data/lib/active_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1305c44f47755be521e42ebb643e3ec9d4e267d2d04199b5e1d182e444d0b275
|
4
|
+
data.tar.gz: 10b756b23a70d5054c1b69f48523c575756a73c184e36ae1fc9aa23291d2a2b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271eb9911286e8970c7ef6327ba67d912b83208d554ebfed7129a4821834373883bb14ef1acd1f43028fcf79fb062f95fda1ff48e7a53bdb2cdfce648d49a0ce
|
7
|
+
data.tar.gz: 2049ff4e916f3f5ba230b060db073380e90e60981393c6dd2abf1870a127a91b2508a92d0d786448c80c17d4d2aeb0b849d06a60ce136317dec932257b7efc95
|
data/README.md
CHANGED
@@ -10,9 +10,10 @@ Position Attribute provides full positioning functionality using lexicographic o
|
|
10
10
|
|
11
11
|
You can also add multiple position attributes in one model to store different arrangements.
|
12
12
|
|
13
|
-
Just create a database column in your model with type :string
|
13
|
+
Just create a database column in your model with type :string having an index.
|
14
14
|
```ruby
|
15
|
-
add_column :products, :arrangement, :string
|
15
|
+
add_column :products, :arrangement, :string
|
16
|
+
add_index :products, :arrangement
|
16
17
|
```
|
17
18
|
|
18
19
|
Then define the column name in your model like below.
|
@@ -42,7 +42,7 @@ module ActiveKit
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def control
|
45
|
-
records = @scoped_class.where.not("#{@name}": nil).
|
45
|
+
records = @scoped_class.where.not("#{@name}": nil).reorder("#{@name}": :asc, id: :asc).select(@name.to_sym)
|
46
46
|
headtier = records.first&.try(@name.to_sym)&.split("|")&.first&.last&.to_i # returns a tire integer
|
47
47
|
foottier = records.last&.try(@name.to_sym)&.split("|")&.first&.last&.to_i # returns a tire integer
|
48
48
|
|
@@ -54,7 +54,7 @@ module ActiveKit
|
|
54
54
|
end
|
55
55
|
scoped_order, chair_method, offset_operator = (ordering == :head_to_foot) ? [:asc, :chair_below, ">"] : [:desc, :chair_above, "<"]
|
56
56
|
|
57
|
-
scoped_class_with_order = @scoped_class.
|
57
|
+
scoped_class_with_order = @scoped_class.reorder("#{@name}": scoped_order, id: scoped_order)
|
58
58
|
scoped_class_with_order_count = scoped_class_with_order.count
|
59
59
|
initial_position = (ordering == :head_to_foot) ? 1 : scoped_class_with_order_count
|
60
60
|
|
data/lib/active_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- plainsource
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|