activekit 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d19ba43a09297c57c1b373864a53bf9b68787fe3a5b46a5167ae178db0800a
4
- data.tar.gz: fee7a6d8f645787a847fd33a3500d0aade7162a8ff855c45349e45f77d4fe437
3
+ metadata.gz: c73cb76ead023d8565b199c3fc7a287108c058423c558a15382f150de64d549a
4
+ data.tar.gz: a1772c9e23aba4cc64bd21756c09770fa386d241f43d78ef346d3c94cd6c823d
5
5
  SHA512:
6
- metadata.gz: 7b4e68fd3ee58d3c8d2d7a40995a12fcce17f8264548eb7a178422a009706741833c727f723cc8888d66409affbe77770c77eced0d75d1c1249ec9c335a54512
7
- data.tar.gz: 0b551a885c6e90178aa7711d8c6356b448a57a28d319ce3daf230e93b2c5d92bd3a2a10f70489ee0cd5f9f77f2490cd6962c33426a089d25dc209d4d9f6d73a5
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 with index.
13
+ Just create a database column in your model with type :string having an index.
14
14
  ```ruby
15
- add_column :products, :arrangement, :string, index: true, before: :created_at
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).order("#{@name}": :asc, id: :asc).select(@name.to_sym)
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.order("#{@name}": scoped_order, id: scoped_order)
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
 
@@ -1,3 +1,3 @@
1
1
  module ActiveKit
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
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.0
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: 2023-12-30 00:00:00.000000000 Z
11
+ date: 2024-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails