acts_as_list 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -4
- data/README.md +3 -3
- data/acts_as_list.gemspec +2 -1
- data/lib/acts_as_list/active_record/acts/position_column_method_definer.rb +6 -5
- data/lib/acts_as_list/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9d85921cd5b149fa3581d5868734c62fb42e449e4058db26cffb0e62a146b9c
|
4
|
+
data.tar.gz: 94b6b6a6599ec0fa381f737bd5b2132258b7620905016bb467e1663f9552021a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f991880d1399bdbe56e4ef2511368115fc382dfebe2549188e0b8123f5cd8a93b33f067a602aadd8dbfa70893662b6fe5072d9deea7aba26d8827b83b9e1ac41
|
7
|
+
data.tar.gz: df1570e602643b91b602ed3044c9fbe8457ce95e42cf8fdca5858d8bd1460f4105f8839bf87c5338cb0fb4cbac11c46b15c6206dc039cc39cc3c1b561129fcee
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## Unreleased
|
8
8
|
|
9
|
+
## v1.2.1 - 2024-06-06
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- We no longer delegate the class `connection` method to the instance. [\#436](https://github.com/brendon/acts_as_list/pull/436) ([davidcelis])
|
13
|
+
|
9
14
|
## v1.2.0 - 2024-06-03
|
10
15
|
|
11
16
|
### Added
|
@@ -265,7 +270,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
265
270
|
**Closed issues:**
|
266
271
|
|
267
272
|
- DEPRECATION WARNING on rails 5.0 as of acts\_as\_list 0.9 [\#251](https://github.com/brendon/acts_as_list/issues/251)
|
268
|
-
-
|
273
|
+
- higher\_items returns items with the same position value [\#247](https://github.com/brendon/acts_as_list/issues/247)
|
269
274
|
- Broken with unique constraint on position [\#245](https://github.com/brendon/acts_as_list/issues/245)
|
270
275
|
|
271
276
|
**Merged pull requests:**
|
@@ -493,7 +498,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
493
498
|
- Fix sanitize\_sql\_hash\_for\_conditions deprecation warning in Rails 4.2 [\#140](https://github.com/brendon/acts_as_list/pull/140) ([eagletmt](https://github.com/eagletmt))
|
494
499
|
- Simpler method to find the subclass name [\#139](https://github.com/brendon/acts_as_list/pull/139) ([brendon](https://github.com/brendon))
|
495
500
|
- Rails4 enum column support [\#130](https://github.com/brendon/acts_as_list/pull/130) ([arunagw](https://github.com/arunagw))
|
496
|
-
- use eval for
|
501
|
+
- use eval for determining the self.class.name useful when this is used in an abstract class [\#123](https://github.com/brendon/acts_as_list/pull/123) ([flarik](https://github.com/flarik))
|
497
502
|
|
498
503
|
## [0.5.0](https://github.com/brendon/acts_as_list/tree/0.5.0) (2014-10-31)
|
499
504
|
[Full Changelog](https://github.com/brendon/acts_as_list/compare/0.4.0...0.5.0)
|
@@ -633,7 +638,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
633
638
|
- acts\_as\_list :scope =\> "doesnt\_seem\_to\_work" [\#12](https://github.com/brendon/acts_as_list/issues/12)
|
634
639
|
- don't work perfectly with default\_scope [\#11](https://github.com/brendon/acts_as_list/issues/11)
|
635
640
|
- MySQL: Position column MUST NOT have default [\#10](https://github.com/brendon/acts_as_list/issues/10)
|
636
|
-
- insert\_at fails on postgresql w/ non-null constraint on
|
641
|
+
- insert\_at fails on postgresql w/ non-null constraint on position\_column [\#8](https://github.com/brendon/acts_as_list/issues/8)
|
637
642
|
|
638
643
|
**Merged pull requests:**
|
639
644
|
|
@@ -642,7 +647,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
642
647
|
- Massive test refactorings. [\#24](https://github.com/brendon/acts_as_list/pull/24) ([splattael](https://github.com/splattael))
|
643
648
|
- Silent migrations to reduce test noise. [\#22](https://github.com/brendon/acts_as_list/pull/22) ([splattael](https://github.com/splattael))
|
644
649
|
- Should decrement lower items after the item has been destroyed to avoid unique key conflicts. [\#18](https://github.com/brendon/acts_as_list/pull/18) ([aepstein](https://github.com/aepstein))
|
645
|
-
- Fix spelling and
|
650
|
+
- Fix spelling and grammar [\#15](https://github.com/brendon/acts_as_list/pull/15) ([tmiller](https://github.com/tmiller))
|
646
651
|
- store\_at\_0 should yank item from the list then decrement items to avoid r [\#14](https://github.com/brendon/acts_as_list/pull/14) ([aepstein](https://github.com/aepstein))
|
647
652
|
- Support default\_scope ordering by calling .unscoped [\#13](https://github.com/brendon/acts_as_list/pull/13) ([tanordheim](https://github.com/tanordheim))
|
648
653
|
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Acts As List
|
2
2
|
|
3
3
|
## Build Status
|
4
|
-
[![
|
4
|
+
[![Continuous Integration](https://github.com/brendon/acts_as_list/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/brendon/acts_as_list/actions/workflows/continuous_integration.yml)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/acts_as_list.svg)](https://badge.fury.io/rb/acts_as_list)
|
6
6
|
|
7
7
|
## ANNOUNCING: Positioning, the gem
|
8
|
-
As maintainer of both Acts As List and the Ranked Model gems, I've become intimately
|
8
|
+
As maintainer of both Acts As List and the Ranked Model gems, I've become intimately acquainted with the strengths and weaknesses of each. I ended up writing a small scale Rails Concern for positioning database rows for a recent project and it worked really well so I've decided to release it as a gem: [Positioning](https://github.com/brendon/positioning)
|
9
9
|
|
10
10
|
Positioning works similarly to Acts As List in that it maintains a sequential list of integer values as positions. It differs in that it encourages a unique constraints on the position column and supports multiple lists per database table. It borrows Ranked Model's concept of relative positioning. I encourage you to check it out and give it a whirl on your project!
|
11
11
|
|
@@ -290,7 +290,7 @@ All versions `0.1.5` onwards require Rails 3.0.x and higher.
|
|
290
290
|
|
291
291
|
We often hear complaints that `position` values are repeated, incorrect etc. For example, #254. To ensure data integrity, you should rely on your database. There are two things you can do:
|
292
292
|
|
293
|
-
1. Use constraints. If you model `Item` that `belongs_to` an `Order`, and it has a `position` column, then add a unique constraint on `items` with `[:order_id, :position]`. Think of it as a list invariant. What are the properties of your list that don't change no matter how many items you have in it? One such
|
293
|
+
1. Use constraints. If you model `Item` that `belongs_to` an `Order`, and it has a `position` column, then add a unique constraint on `items` with `[:order_id, :position]`. Think of it as a list invariant. What are the properties of your list that don't change no matter how many items you have in it? One such property is that each item has a distinct position. Another _could be_ that position is always greater than 0. It is strongly recommended that you rely on your database to enforce these invariants or constraints. Here are the docs for [PostgreSQL](https://www.postgresql.org/docs/9.5/static/ddl-constraints.html) and [MySQL](https://dev.mysql.com/doc/refman/8.0/en/alter-table.html).
|
294
294
|
2. Use mutexes or row level locks. At its heart the duplicate problem is that of handling concurrency. Adding a contention resolution mechanism like locks will solve it to some extent. But it is not a solution or replacement for constraints. Locks are also prone to deadlocks.
|
295
295
|
|
296
296
|
As a library, `acts_as_list` may not always have all the context needed to apply these tools. They are much better suited at the application level.
|
data/acts_as_list.gemspec
CHANGED
@@ -13,12 +13,13 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.summary = "A gem adding sorting, reordering capabilities to an active_record model, allowing it to act as a list"
|
14
14
|
s.description = 'This "acts_as" extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a "position" column defined as an integer on the mapped database table.'
|
15
15
|
s.license = "MIT"
|
16
|
-
s.required_ruby_version = ">= 2.
|
16
|
+
s.required_ruby_version = ">= 2.5"
|
17
17
|
|
18
18
|
if s.respond_to?(:metadata)
|
19
19
|
s.metadata['changelog_uri'] = 'https://github.com/brendon/acts_as_list/blob/master/CHANGELOG.md'
|
20
20
|
s.metadata['source_code_uri'] = 'https://github.com/brendon/acts_as_list'
|
21
21
|
s.metadata['bug_tracker_uri'] = 'https://github.com/brendon/acts_as_list/issues'
|
22
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
22
23
|
end
|
23
24
|
|
24
25
|
# Load Paths...
|
@@ -72,17 +72,18 @@ module ActiveRecord::Acts::List::PositionColumnMethodDefiner #:nodoc:
|
|
72
72
|
cached_quoted_now = quoted_current_time_from_proper_timezone
|
73
73
|
|
74
74
|
timestamp_attributes_for_update_in_model.map do |attr|
|
75
|
-
", #{connection.quote_column_name(attr)} = #{cached_quoted_now}"
|
75
|
+
", #{self.class.connection.quote_column_name(attr)} = #{cached_quoted_now}"
|
76
76
|
end.join
|
77
77
|
end
|
78
78
|
|
79
79
|
private
|
80
80
|
|
81
|
-
delegate :connection, to: self
|
82
|
-
|
83
81
|
def quoted_current_time_from_proper_timezone
|
84
|
-
connection.quote(
|
85
|
-
|
82
|
+
self.class.connection.quote(
|
83
|
+
self.class.connection.quoted_date(
|
84
|
+
current_time_from_proper_timezone
|
85
|
+
)
|
86
|
+
)
|
86
87
|
end
|
87
88
|
end
|
88
89
|
end
|
data/lib/acts_as_list/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swanand Pagnis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-06-
|
12
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -182,6 +182,7 @@ metadata:
|
|
182
182
|
changelog_uri: https://github.com/brendon/acts_as_list/blob/master/CHANGELOG.md
|
183
183
|
source_code_uri: https://github.com/brendon/acts_as_list
|
184
184
|
bug_tracker_uri: https://github.com/brendon/acts_as_list/issues
|
185
|
+
rubygems_mfa_required: 'true'
|
185
186
|
post_install_message:
|
186
187
|
rdoc_options: []
|
187
188
|
require_paths:
|
@@ -190,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
191
|
requirements:
|
191
192
|
- - ">="
|
192
193
|
- !ruby/object:Gem::Version
|
193
|
-
version: 2.
|
194
|
+
version: '2.5'
|
194
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
196
|
requirements:
|
196
197
|
- - ">="
|