positioning 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0d883985a674ffd2262b5ae6fbfa004cdeb21f76cb4f47b293c252498abf047
4
- data.tar.gz: 6b2e92166a991cc255e9db3eacd1f3a504e165033d5351285c6200e6a4e44f78
3
+ metadata.gz: 42c7d9b5b08bb03060627230a1b44fe9d243b57779541de8def15a0f49f57011
4
+ data.tar.gz: 66a36e6cc2f019a34c4e1c0d92700be81062556c01da38de8fed632f12bde607
5
5
  SHA512:
6
- metadata.gz: 3a21c3d4429ba5bb280490e555781023a4062df76760d37ae77c073cacb8e875c3a57e9735f15e042d9ed63445865ce1bddf4e52ef3a6db79896945fd8b417e2
7
- data.tar.gz: 658091668c0a500dddd65275bfabc4506358fce770cc6b9a01026f7803d26a10386e37fec883a13a96e3f42be8d879d936efafec5127880b9e55fa5ca62ee0d2
6
+ metadata.gz: 50b3a860281e94d7657b82265e639f038d0004bbfde9d3cf19ca38aeab77814a92d31f5660e6f802c4c72c8931e42c960313413660dd48b0cbc81ca3c899ca30
7
+ data.tar.gz: 71718c58f8ada39e8b089cc2a2de1da96b685099461b5b397fd40c766549e60279e7b5e6c7d3a61081d5e435b18d3d24e260d985bbda5f2916669f3bdd8f1321
data/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.1] - 2024-02-07
3
+ ## [0.1.2] - 2024-02-29
4
+
5
+ - Fix a bug related to the scope changing with an explicitly set position value that is the same as the original position.
6
+
7
+ ## [0.1.1] - 2024-02-25
4
8
 
5
9
  - Fix issues with STI based models
6
10
 
7
- ## [0.1.0] - 2024-02-07
11
+ ## [0.1.0] - 2024-02-24
8
12
 
9
13
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- positioning (0.1.1)
4
+ positioning (0.1.2)
5
5
  activerecord (>= 6.1)
6
6
  activesupport (>= 6.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (7.1.3)
12
- activesupport (= 7.1.3)
13
- activerecord (7.1.3)
14
- activemodel (= 7.1.3)
15
- activesupport (= 7.1.3)
11
+ activemodel (7.1.3.2)
12
+ activesupport (= 7.1.3.2)
13
+ activerecord (7.1.3.2)
14
+ activemodel (= 7.1.3.2)
15
+ activesupport (= 7.1.3.2)
16
16
  timeout (>= 0.4.0)
17
- activesupport (7.1.3)
17
+ activesupport (7.1.3.2)
18
18
  base64
19
19
  bigdecimal
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -39,10 +39,6 @@ module Positioning
39
39
 
40
40
  contract(positioning_scope_was, position_was..)
41
41
  expand(positioning_scope, position..)
42
-
43
- # If the position integer was set to the same as its prior value but the scope has changed then
44
- # we need to tell Rails that it has changed so that it gets updated from the temporary 0 value.
45
- position_will_change!
46
42
  elsif position_was > position
47
43
  expand(positioning_scope, position..position_was)
48
44
  else
@@ -81,10 +77,6 @@ module Positioning
81
77
  @positioned.send :"#{@column}_changed?"
82
78
  end
83
79
 
84
- def position_will_change!
85
- @positioned.send :"#{@column}_will_change!"
86
- end
87
-
88
80
  def expand(scope, range)
89
81
  scope.where("#{@column}": range).update_all "#{@column} = #{@column} * -1"
90
82
  scope.where("#{@column}": ..-1).update_all "#{@column} = #{@column} * -1 + 1"
@@ -1,3 +1,3 @@
1
1
  module Positioning
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/positioning.rb CHANGED
@@ -34,6 +34,11 @@ module Positioning
34
34
  define_method(:"prior_#{column}") { Mechanisms.new(self, column).prior }
35
35
  define_method(:"subsequent_#{column}") { Mechanisms.new(self, column).subsequent }
36
36
 
37
+ redefine_method(:"#{column}=") do |position|
38
+ send :"#{column}_will_change!"
39
+ super(position)
40
+ end
41
+
37
42
  before_create { Mechanisms.new(self, column).create_position }
38
43
  before_update { Mechanisms.new(self, column).update_position }
39
44
  after_destroy { Mechanisms.new(self, column).destroy_position }
data/positioning.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
 
14
14
  spec.metadata["homepage_uri"] = spec.homepage
15
15
  spec.metadata["source_code_uri"] = "https://github.com/brendon/positioning"
16
- spec.metadata["changelog_uri"] = "https://github.com/brendon/positioning/CHANGELOG.md"
16
+ spec.metadata["changelog_uri"] = "https://github.com/brendon/positioning/blob/main/CHANGELOG.md"
17
17
 
18
18
  # Specify which files should be added to the gem when it is released.
19
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: positioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendon Muir
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-25 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -133,7 +133,7 @@ licenses:
133
133
  metadata:
134
134
  homepage_uri: https://github.com/brendon/positioning
135
135
  source_code_uri: https://github.com/brendon/positioning
136
- changelog_uri: https://github.com/brendon/positioning/CHANGELOG.md
136
+ changelog_uri: https://github.com/brendon/positioning/blob/main/CHANGELOG.md
137
137
  post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths: