power_enum 4.1.0 → 4.2.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: 35edbdb441b395299aa1f20a3719b5be76944f65eece54831eae69b3ffb57a9a
|
|
4
|
+
data.tar.gz: c4a2ce79baaa5bf26e056f1e4ab2470a34d40c0456931850c0b9c4ca5c5580ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 025f11e5861f9e3a0fd9d0f5dc2d547944ae4dac506432d1e08eee1afe4117b359e41c93962006c94e3c05ced183b7c733d0681e8e0a35a7cccfdab7d0afb3f2
|
|
7
|
+
data.tar.gz: 744d9fecff6322d6faab40418ebac2d438b8140c2363b23fe20a5cfc4813002c0f3b85788849f4c4e65c86128eaa711d3f8b8d6bdc895291f5731223fb4d2529
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.2.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
|
|
@@ -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.2.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: 2025-
|
|
14
|
+
date: 2025-10-24 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: bundler
|