power_enum 4.1.0 → 4.3.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a4590529169ea38e3c39d111866c615c95516f1079d855c623b794df6a015d13
|
|
4
|
+
data.tar.gz: 0d73cb99bf685e1b26571d40664b63ba5de64c570f68baee0765e1a755c38529
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 365465c3bd51e698ee53ff98f80c3e0914afa4df64511a7c9c5d4cfee19e9bd93c7d66d14b24c5858e24cf08fa093a4d9c5c7abb08127e7a55c651d8a6d1d022
|
|
7
|
+
data.tar.gz: 429c63fd173a1953ea50b3ae9b17c7dc8ee2c997bf0763e7ba9879f59fd75d035ece1aef40a917dc9755e53052bdfccf04d32c888a7e3b5120e9d70122bda84f
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.3.0
|
|
@@ -11,7 +11,8 @@ module EnumGeneratorHelpers
|
|
|
11
11
|
# Lifted directly from ActiveRecord::Generators::Migration
|
|
12
12
|
# Unfortunately, no API is provided by Rails at this time.
|
|
13
13
|
next_migration_number = current_migration_number(dirname) + 1
|
|
14
|
-
if ActiveRecord::Base.timestamped_migrations
|
|
14
|
+
if (ActiveRecord::Base.respond_to?(:timestamped_migrations) && ActiveRecord::Base.timestamped_migrations) ||
|
|
15
|
+
(ActiveRecord.respond_to?(:timestamped_migrations) && ActiveRecord.timestamped_migrations) # Changed in Rails 7.1
|
|
15
16
|
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
|
16
17
|
else
|
|
17
18
|
"%.3d" % next_migration_number
|
|
@@ -131,7 +131,7 @@ module PowerEnum
|
|
|
131
131
|
private def create_ar_reflection(part_id, options)
|
|
132
132
|
reflection = PowerEnum::Reflection::EnumerationReflection.new(part_id, options, self)
|
|
133
133
|
|
|
134
|
-
self._reflections = self._reflections.merge(part_id.to_s => reflection)
|
|
134
|
+
self._reflections = self._reflections.merge(part_id.to_s => reflection, part_id.to_sym => reflection)
|
|
135
135
|
reflection
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -108,7 +108,7 @@ of these associations is deprecated and will be removed in the future.
|
|
|
108
108
|
def check_validity!; end
|
|
109
109
|
|
|
110
110
|
# Returns nil
|
|
111
|
-
def source_reflection
|
|
111
|
+
def source_reflection
|
|
112
112
|
nil
|
|
113
113
|
end
|
|
114
114
|
|
|
@@ -117,6 +117,9 @@ of these associations is deprecated and will be removed in the future.
|
|
|
117
117
|
nil
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
# https://github.com/rails/rails/pull/48362
|
|
121
|
+
alias_method :join_primary_type, :type
|
|
122
|
+
|
|
120
123
|
# Always returns false. Necessary for stuff like Booking.where(:status => BookingStatus[:confirmed])
|
|
121
124
|
def polymorphic?
|
|
122
125
|
false
|
|
@@ -127,6 +130,11 @@ of these associations is deprecated and will be removed in the future.
|
|
|
127
130
|
true
|
|
128
131
|
end
|
|
129
132
|
|
|
133
|
+
# https://github.com/rails/rails/pull/55285
|
|
134
|
+
def deprecated?
|
|
135
|
+
false
|
|
136
|
+
end
|
|
137
|
+
|
|
130
138
|
# In this case, returns [[]]
|
|
131
139
|
def conditions
|
|
132
140
|
[[]]
|
|
@@ -9,10 +9,16 @@ module PowerEnum::Schema
|
|
|
9
9
|
module SchemaStatements
|
|
10
10
|
|
|
11
11
|
def self.included(base) # :nodoc:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
%w[AbstractAdapter PostgreSQLAdapter].each do |name|
|
|
14
|
+
if base.const_defined?(name)
|
|
15
|
+
base.const_get(name).class_eval do
|
|
16
|
+
# Currently defined in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#create_enum
|
|
17
|
+
# This squashes the "#create_enum" in the PostgreSQL adapter in Rails 7+.
|
|
18
|
+
# .../activerecord-7.0.X.Y/lib/active_record/connection_adapters/postgresql_adapter.rb
|
|
19
|
+
prepend PowerEnum::Schema::AbstractAdapter
|
|
20
|
+
end
|
|
21
|
+
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: power_enum
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trevor Squires
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2026-07-10 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: bundler
|
|
@@ -64,7 +64,7 @@ dependencies:
|
|
|
64
64
|
version: '6.0'
|
|
65
65
|
- - "<"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
67
|
+
version: '9'
|
|
68
68
|
type: :development
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -74,7 +74,7 @@ dependencies:
|
|
|
74
74
|
version: '6.0'
|
|
75
75
|
- - "<"
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
77
|
+
version: '9'
|
|
78
78
|
- !ruby/object:Gem::Dependency
|
|
79
79
|
name: railties
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -84,7 +84,7 @@ dependencies:
|
|
|
84
84
|
version: '6.0'
|
|
85
85
|
- - "<"
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '
|
|
87
|
+
version: '9'
|
|
88
88
|
type: :runtime
|
|
89
89
|
prerelease: false
|
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -94,7 +94,7 @@ dependencies:
|
|
|
94
94
|
version: '6.0'
|
|
95
95
|
- - "<"
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: '
|
|
97
|
+
version: '9'
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
99
|
name: activerecord
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +104,7 @@ dependencies:
|
|
|
104
104
|
version: '6.0'
|
|
105
105
|
- - "<"
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '
|
|
107
|
+
version: '9'
|
|
108
108
|
type: :runtime
|
|
109
109
|
prerelease: false
|
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -114,7 +114,7 @@ dependencies:
|
|
|
114
114
|
version: '6.0'
|
|
115
115
|
- - "<"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
117
|
+
version: '9'
|
|
118
118
|
description: |
|
|
119
119
|
Power Enum allows you to treat instances of your ActiveRecord models as though they were an enumeration of values.
|
|
120
120
|
It allows you to cleanly solve many of the problems that the traditional Rails alternatives handle poorly if at all.
|
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
166
|
- !ruby/object:Gem::Version
|
|
167
167
|
version: '0'
|
|
168
168
|
requirements: []
|
|
169
|
-
rubygems_version: 3.
|
|
169
|
+
rubygems_version: 3.3.26
|
|
170
170
|
signing_key:
|
|
171
171
|
specification_version: 4
|
|
172
172
|
summary: Allows you to treat instances of your ActiveRecord models as though they
|