power_enum 3.3.0 → 3.6.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 +5 -5
- data/README.markdown +14 -31
- data/VERSION +1 -0
- data/lib/power_enum/enumerated.rb +445 -440
- data/lib/power_enum/has_enumerated.rb +175 -172
- data/lib/power_enum/reflection.rb +5 -0
- data/lib/power_enum.rb +26 -16
- metadata +14 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: '096a1a60d97b933ef84c3911621c9f277a03c34ede014c7177f2b2a69c8d91c2'
|
|
4
|
+
data.tar.gz: f448294f91b76d19a31379c517787eadae5616e85cefe90072cfb5b25c648ab4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e68bc90dfa496b02d65146aeca6d6aec40998c425d7fd6bf11dd746c141160e66144cb8b4ca64c7dc6b5bae2f64b77811138cc077f6b13e5ad449aea9e523b1a
|
|
7
|
+
data.tar.gz: 450e41935d70e667db676ce92c2a685d79e152c06826a6253728003b72e58aa6ad69518b8be3d7893073a797791a0ddae425c9f317a290515371b06c3bd74765
|
data/README.markdown
CHANGED
|
@@ -10,7 +10,7 @@ Enumerations for Rails Done Right.
|
|
|
10
10
|
|
|
11
11
|
## Versions
|
|
12
12
|
|
|
13
|
-
* PowerEnum 3.X (this version) supports Rails 4.2 and Rails
|
|
13
|
+
* PowerEnum 3.X (this version) supports Rails 4.2, Rails 5.X and Rails 6.0
|
|
14
14
|
* PowerEnum 2.X supports Rails 4.X and Rails 5.0
|
|
15
15
|
* PowerEnum 1.X supports Rails 3.1/3.2, available here: https://github.com/albertosaurus/power_enum
|
|
16
16
|
|
|
@@ -54,7 +54,7 @@ See "How to use it" below for more information.
|
|
|
54
54
|
### PowerEnum 3.X
|
|
55
55
|
|
|
56
56
|
* Ruby 2.1 or later (JRuby should work but isn't extensively tested; Travis is being difficult).
|
|
57
|
-
* Rails 4.2, 5.0, 5.1
|
|
57
|
+
* Rails 4.2, 5.0, 5.1, 5.2, 6.0
|
|
58
58
|
|
|
59
59
|
### PowerEnum 2.X
|
|
60
60
|
|
|
@@ -63,26 +63,7 @@ See "How to use it" below for more information.
|
|
|
63
63
|
|
|
64
64
|
## Installation
|
|
65
65
|
|
|
66
|
-
###
|
|
67
|
-
|
|
68
|
-
This gem is signed. The public key is available
|
|
69
|
-
here: https://github.com/albertosaurus/power_enum (look for gem-public\_cert.pem). Hence, if
|
|
70
|
-
you can get an error like the following if you're installing in `HighSecurity` mode.
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
ERROR: While executing gem ... (RuntimeError)
|
|
74
|
-
Couldn't verify data signature: Untrusted Signing Chain Root: cert = 'cert name', error = 'path "/your_gem_home/.gem/trust/cert-blah.pem" does not exist'
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
If this happens, you need to add the PowerEnum public cert to your gem cert
|
|
78
|
-
store. Download the certificate (gem-public\_cert.pem) and run the following.
|
|
79
|
-
|
|
80
|
-
gem cert -a gem-public_cert.pem
|
|
81
|
-
|
|
82
|
-
More information is available at http://guides.rubygems.org/security/
|
|
83
|
-
which I strongly urge you to read.
|
|
84
|
-
|
|
85
|
-
#### Using Bundler
|
|
66
|
+
### Using Bundler
|
|
86
67
|
|
|
87
68
|
Add the gem to your Gemfile
|
|
88
69
|
|
|
@@ -92,7 +73,7 @@ then run
|
|
|
92
73
|
|
|
93
74
|
bundle install
|
|
94
75
|
|
|
95
|
-
|
|
76
|
+
### Manual Installation
|
|
96
77
|
|
|
97
78
|
gem install power_enum
|
|
98
79
|
|
|
@@ -198,7 +179,7 @@ create_table :bookings do |t|
|
|
|
198
179
|
t.timestamps
|
|
199
180
|
end
|
|
200
181
|
```
|
|
201
|
-
|
|
182
|
+
|
|
202
183
|
There are two methods added to Rails migrations:
|
|
203
184
|
|
|
204
185
|
##### create\_enum(enum\_name, options = {}, &block)
|
|
@@ -285,7 +266,7 @@ Example:
|
|
|
285
266
|
```ruby
|
|
286
267
|
remove_enum :booking_status
|
|
287
268
|
```
|
|
288
|
-
|
|
269
|
+
|
|
289
270
|
is the equivalent of
|
|
290
271
|
|
|
291
272
|
```ruby
|
|
@@ -298,10 +279,12 @@ drop_table :booking_statuses
|
|
|
298
279
|
class BookingStatus < ActiveRecord::Base
|
|
299
280
|
acts_as_enumerated :conditions => 'optional_sql_conditions',
|
|
300
281
|
:order => 'optional_sql_order_by',
|
|
301
|
-
:on_lookup_failure => :optional_class_method, #This also works: lambda{ |arg| some_custom_action }
|
|
302
|
-
:name_column => 'optional_name_column' #If required, may override the default name column
|
|
303
|
-
:alias_name => false
|
|
304
|
-
#
|
|
282
|
+
:on_lookup_failure => :optional_class_method, # This also works: lambda{ |arg| some_custom_action }
|
|
283
|
+
:name_column => 'optional_name_column' # If required, may override the default name column
|
|
284
|
+
:alias_name => false, # If set to false and have name_column set, will not
|
|
285
|
+
# alias :name to the name column attribute.
|
|
286
|
+
:freeze_members => true # Optional, default is true in prod.
|
|
287
|
+
# This also works: lambda { true }
|
|
305
288
|
end
|
|
306
289
|
```
|
|
307
290
|
|
|
@@ -788,7 +771,7 @@ Execute the test setup script:
|
|
|
788
771
|
#### Manually (if required)
|
|
789
772
|
|
|
790
773
|
Go to the 'dummy' project:
|
|
791
|
-
|
|
774
|
+
|
|
792
775
|
cd ./spec/dummy
|
|
793
776
|
|
|
794
777
|
If this is your first time, create the test database
|
|
@@ -812,7 +795,7 @@ Go back to gem root directory:
|
|
|
812
795
|
* Initial Version Copyright (c) 2005 Trevor Squires
|
|
813
796
|
* Rails 3 Updates Copyright (c) 2010 Pivotal Labs
|
|
814
797
|
* Initial Test Suite Copyright (c) 2011 Sergey Potapov
|
|
815
|
-
* Subsequent Updates Copyright (c) 2011-
|
|
798
|
+
* Subsequent Updates Copyright (c) 2011-2020 Arthur Shagall
|
|
816
799
|
|
|
817
800
|
Released under the MIT License. See the LICENSE file for more details.
|
|
818
801
|
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.6.0
|