selection_options_for 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +13 -11
- data/lib/selection_options_for/version.rb +1 -1
- data/pkg/selection_options_for-0.0.7.gem +0 -0
- data/pkg/selection_options_for-0.0.8.gem +0 -0
- metadata +2 -1
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,11 @@ This code allows you to keep the display labels in the model
|
|
4
4
|
when the DB holds only a 1 character flag.
|
5
5
|
and when the code requires symbolic references to the value to use in algorithms
|
6
6
|
|
7
|
+
## Note
|
8
|
+
Please see also the new 'state_objects' Gem
|
9
|
+
StateObjects also supports behavior changes based on state and reduces conditional logic.
|
10
|
+
https://github.com/mwindholtz/state_objects
|
11
|
+
|
7
12
|
## Installation
|
8
13
|
|
9
14
|
Add this line to your application's Gemfile:
|
@@ -26,8 +31,8 @@ Or install it yourself as:
|
|
26
31
|
and when the code requires symbolic references to the value to use in algorithms
|
27
32
|
|
28
33
|
* element 0 of the array passed in is always the logical symbol
|
29
|
-
*
|
30
|
-
*
|
34
|
+
* 3-element Array is passed in, [key, DB value, label]
|
35
|
+
* Removed: (2-element Array. This is no longer supported)
|
31
36
|
* Any other type passed in throws an error
|
32
37
|
|
33
38
|
## Limitations:
|
@@ -37,9 +42,9 @@ Or install it yourself as:
|
|
37
42
|
|
38
43
|
class Article < ActiveRecord::Base
|
39
44
|
selection_options_for :file_type_option,
|
40
|
-
[:pdf, 'PDF'],
|
41
|
-
[:html, 'HTML'],
|
42
|
-
[:msword, 'MS-Word']
|
45
|
+
[:pdf, 'P', 'PDF'],
|
46
|
+
[:html, 'H', 'HTML'],
|
47
|
+
[:msword, 'M', 'MS-Word']
|
43
48
|
[:text, 'X', 'Textfile']
|
44
49
|
end
|
45
50
|
|
@@ -105,13 +110,11 @@ In the example below 'R' is stored in the database when
|
|
105
110
|
|
106
111
|
class Article < ActiveRecord::Base
|
107
112
|
selection_options_for :payment_method_option,
|
108
|
-
[:basic,
|
109
|
-
[:cash,
|
110
|
-
[:cc,
|
113
|
+
[:basic, 'B', 'Basic'],
|
114
|
+
[:cash, 'C', 'Cash Account'],
|
115
|
+
[:cc, 'R','Credit Card Account']
|
111
116
|
end
|
112
117
|
|
113
|
-
|
114
|
-
|
115
118
|
<%= select :article, :payment_method_option, Article.payment_method_options %>
|
116
119
|
|
117
120
|
|
@@ -124,7 +127,6 @@ In the example below 'R' is stored in the database when
|
|
124
127
|
|
125
128
|
### Example #4 in a java_script list
|
126
129
|
|
127
|
-
|
128
130
|
payment_method_option_js_list
|
129
131
|
|
130
132
|
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selection_options_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- pkg/selection_options_for-0.0.5.gem
|
71
71
|
- pkg/selection_options_for-0.0.6.gem
|
72
72
|
- pkg/selection_options_for-0.0.7.gem
|
73
|
+
- pkg/selection_options_for-0.0.8.gem
|
73
74
|
- selection_options_for.gemspec
|
74
75
|
- test/selection_options_for_ex_test.rb
|
75
76
|
- test/selection_options_for_test.rb
|