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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d19ba43a09297c57c1b373864a53bf9b68787fe3a5b46a5167ae178db0800a
4
- data.tar.gz: fee7a6d8f645787a847fd33a3500d0aade7162a8ff855c45349e45f77d4fe437
3
+ metadata.gz: 1305c44f47755be521e42ebb643e3ec9d4e267d2d04199b5e1d182e444d0b275
4
+ data.tar.gz: 10b756b23a70d5054c1b69f48523c575756a73c184e36ae1fc9aa23291d2a2b7
5
5
  SHA512:
6
- metadata.gz: 7b4e68fd3ee58d3c8d2d7a40995a12fcce17f8264548eb7a178422a009706741833c727f723cc8888d66409affbe77770c77eced0d75d1c1249ec9c335a54512
7
- data.tar.gz: 0b551a885c6e90178aa7711d8c6356b448a57a28d319ce3daf230e93b2c5d92bd3a2a10f70489ee0cd5f9f77f2490cd6962c33426a089d25dc209d4d9f6d73a5
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 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
 
@@ -5,7 +5,7 @@ module ActiveKit
5
5
  @record = record
6
6
  @name = name
7
7
 
8
- @scoped_class = @record.class.where(scope).order("#{@name}": :asc)
8
+ @scoped_class = @record.class.where(scope).reorder("#{@name}": :asc)
9
9
  @reharmonize = false
10
10
  @positioning = Positioning.new
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveKit
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.2'
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.2
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