power_enum 3.7.0 → 4.0.1
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 +4 -4
- data/README.markdown +13 -7
- data/VERSION +1 -1
- data/lib/power_enum/schema/schema_statements.rb +4 -2
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d082903c63c4312b09017f253ab915ce20548fae15d69472afa0781a8880354
|
4
|
+
data.tar.gz: 726cf42b46643730d6999adb7f7ecebbbc0dd952cecca428ffaac153555cabee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5c5ef9ffde3a15bea67001ad4c27763488268ed6d850f0e8a25bde2a1ce24b48e4f5db979c90aa4de95c32f9e7ac51825fc6909dd2594cb5b2dbf7de59490d3
|
7
|
+
data.tar.gz: e4ca6e0641f07b4d0357b260e17175263094f4fe8234f195082a69527ebc7384b6ecb5ee42bf7fd02f2c7322cbe816dede2d403bd494d5096cfb72d0fe0ff26f
|
data/README.markdown
CHANGED
@@ -10,7 +10,8 @@ Enumerations for Rails Done Right.
|
|
10
10
|
|
11
11
|
## Versions
|
12
12
|
|
13
|
-
* PowerEnum
|
13
|
+
* PowerEnum 4.0.X (this version) supports Rails 6.X, and Rails 7.0 (Experimental)
|
14
|
+
* PowerEnum 3.X supports Rails 4.2, Rails 5.X and Rails 6.0
|
14
15
|
* PowerEnum 2.X supports Rails 4.X and Rails 5.0
|
15
16
|
* PowerEnum 1.X supports Rails 3.1/3.2, available here: https://github.com/albertosaurus/power_enum
|
16
17
|
|
@@ -52,9 +53,14 @@ See "How to use it" below for more information.
|
|
52
53
|
|
53
54
|
## Requirements
|
54
55
|
|
56
|
+
### PowerEnum 4.0.X
|
57
|
+
|
58
|
+
* Ruby 2.7 or later (JRuby should work but isn't extensively tested).
|
59
|
+
* Rails 6.0, 6.1, 6.2, 7.0
|
60
|
+
|
55
61
|
### PowerEnum 3.X
|
56
62
|
|
57
|
-
* Ruby 2.1 or later (JRuby should work but isn't extensively tested
|
63
|
+
* Ruby 2.1 or later (JRuby should work but isn't extensively tested).
|
58
64
|
* Rails 4.2, 5.0, 5.1, 5.2, 6.0
|
59
65
|
|
60
66
|
### PowerEnum 2.X
|
@@ -78,10 +84,6 @@ then run
|
|
78
84
|
|
79
85
|
gem install power_enum
|
80
86
|
|
81
|
-
If you want to verify the gem signature, use the `HighSecurity` installation option.
|
82
|
-
|
83
|
-
gem install power_enum -P HighSecurity
|
84
|
-
|
85
87
|
## Gem Contents
|
86
88
|
|
87
89
|
This package adds:
|
@@ -152,6 +154,8 @@ create_enum :booking_status, :name_limit => 50
|
|
152
154
|
# end
|
153
155
|
```
|
154
156
|
|
157
|
+
**WARNING - This conflicts with PostgreSQL enum support in Rails 7+ and will be renamed in future versions.**
|
158
|
+
|
155
159
|
Now, when you create your Booking model, your migration should create a reference column for status id's and a foreign
|
156
160
|
key relationship to the booking\_statuses table.
|
157
161
|
|
@@ -163,7 +167,7 @@ create_table :bookings do |t|
|
|
163
167
|
end
|
164
168
|
|
165
169
|
# It's highly recommended to add a foreign key constraint here.
|
166
|
-
# Ideally, you would use a gem of some sort to handle this.
|
170
|
+
# Ideally, you would use a gem of some sort to handle this for Rails < 6.
|
167
171
|
# I have been using PgPower https://rubygems.org/gems/pg_power with much
|
168
172
|
# success. It's fork, PgSaurus https://rubygems.org/gems/pg_saurus should
|
169
173
|
# work just as well.
|
@@ -185,6 +189,8 @@ There are two methods added to Rails migrations:
|
|
185
189
|
|
186
190
|
##### create\_enum(enum\_name, options = {}, &block)
|
187
191
|
|
192
|
+
**WARNING - This conflicts with PostgreSQL enum support in Rails 7+ and will be renamed in future versions.**
|
193
|
+
|
188
194
|
Creates a new enum table. `enum_name` will be automatically pluralized. The following options are supported:
|
189
195
|
|
190
196
|
- [:name\_column] Specify the column name for name of the enum. By default it's :name. This can be a String or a Symbol
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
4.0.1
|
@@ -8,7 +8,9 @@ module PowerEnum::Schema
|
|
8
8
|
|
9
9
|
def self.included(base) # :nodoc:
|
10
10
|
base::AbstractAdapter.class_eval do
|
11
|
-
|
11
|
+
# This squashes the "#create_enum" in the PostgreSQL adapter in Rails 7+.
|
12
|
+
# .../activerecord-7.0.X.Y/lib/active_record/connection_adapters/postgresql_adapter.rb
|
13
|
+
prepend PowerEnum::Schema::AbstractAdapter
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -92,7 +94,7 @@ module PowerEnum::Schema
|
|
92
94
|
desc_limit = options[:desc_limit]
|
93
95
|
table_options = options[:table_options] || {}
|
94
96
|
|
95
|
-
create_table enum_table_name, table_options do |t|
|
97
|
+
create_table enum_table_name, **table_options do |t|
|
96
98
|
t.string name_column, :limit => name_limit, :null => false
|
97
99
|
if generate_description
|
98
100
|
t.string :description, :limit => desc_limit
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Squires
|
8
8
|
- Pivotal Labs
|
9
9
|
- Arthur Shagall
|
10
10
|
- Sergey Potapov
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -61,60 +61,60 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
64
|
+
version: '6.0'
|
65
65
|
- - "<"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '8'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '6.0'
|
75
75
|
- - "<"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '8'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: railties
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '6.0'
|
85
85
|
- - "<"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '8'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '6.0'
|
95
95
|
- - "<"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '8'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: activerecord
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
104
|
+
version: '6.0'
|
105
105
|
- - "<"
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: '
|
107
|
+
version: '8'
|
108
108
|
type: :runtime
|
109
109
|
prerelease: false
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: '
|
114
|
+
version: '6.0'
|
115
115
|
- - "<"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '8'
|
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.
|
@@ -151,7 +151,7 @@ homepage: http://github.com/albertosaurus/power_enum_2
|
|
151
151
|
licenses:
|
152
152
|
- MIT
|
153
153
|
metadata: {}
|
154
|
-
post_install_message:
|
154
|
+
post_install_message:
|
155
155
|
rdoc_options: []
|
156
156
|
require_paths:
|
157
157
|
- lib
|
@@ -159,15 +159,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
requirements:
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
162
|
+
version: 2.7.0
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
170
|
-
signing_key:
|
169
|
+
rubygems_version: 3.2.3
|
170
|
+
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Allows you to treat instances of your ActiveRecord models as though they
|
173
173
|
were an enumeration of values
|