activekit 0.3.0 → 0.3.1
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/README.md +3 -2
- data/lib/active_kit/position/harmonize.rb +2 -2
- 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: c73cb76ead023d8565b199c3fc7a287108c058423c558a15382f150de64d549a
|
4
|
+
data.tar.gz: a1772c9e23aba4cc64bd21756c09770fa386d241f43d78ef346d3c94cd6c823d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e7e2a9318cb06bd2580d5d8a1a7ce34336de43bf1f66afed0b447e66daecc634713864483a4ff48f113392d5f160afe677600f2b5e83f473204603b7595d78
|
7
|
+
data.tar.gz: 8f73c668f085980288cfbea6743a83d5999807789160cdbcbd01cb345f39cba386d9d80ec2d2af344a8e3a05a3e37ed0d2ce5642a77d7c67c1bed62ec07ecbb6
|
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.1
|
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
|