err_supply 0.0.4 → 0.0.5
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.
- data/README.md +10 -14
- data/lib/err_supply/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -6,7 +6,6 @@ The helper unpacks and rekeys the standard Rails error hash to make applying err
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
***
|
10
9
|
## What Is This?
|
11
10
|
|
12
11
|
Err Supply is designed to make the default Rails error reporting structure more useful for complex
|
@@ -68,7 +67,6 @@ both values? Or, do they both have problems?
|
|
68
67
|
|
69
68
|
|
70
69
|
|
71
|
-
***
|
72
70
|
## Our Solution
|
73
71
|
|
74
72
|
Err Supply converts the Rails error hash from a slightly ambiguous object graph to a flat, unambiguous
|
@@ -82,7 +80,6 @@ form submissions to be run through a single piece of code.
|
|
82
80
|
|
83
81
|
|
84
82
|
|
85
|
-
***
|
86
83
|
## Installation
|
87
84
|
|
88
85
|
Install me from RubyGems.org by adding a gem dependency to your Gemfile. Bundler does
|
@@ -100,7 +97,6 @@ in the err_supply error hash.
|
|
100
97
|
|
101
98
|
|
102
99
|
|
103
|
-
***
|
104
100
|
## Basic Usage
|
105
101
|
|
106
102
|
The main `err_supply` helper returns an escaped javascript invocation that triggers a custom
|
@@ -115,7 +111,7 @@ are named in the standard rails way and that all error attribute keys match the
|
|
115
111
|
keys exactly.
|
116
112
|
|
117
113
|
|
118
|
-
### Whitelists/Blacklists
|
114
|
+
### 1. Whitelists/Blacklists
|
119
115
|
|
120
116
|
Attributes can be whitelisted or blacklisted using the standard `:only` and `:except` notation.
|
121
117
|
|
@@ -124,7 +120,7 @@ required. They typically only make sense for minor actions against models with
|
|
124
120
|
many attributes.
|
125
121
|
|
126
122
|
|
127
|
-
### Changing Labels
|
123
|
+
### 2. Changing Labels
|
128
124
|
|
129
125
|
Say a User class has an attribute `:born_on` to store the user's date of birth. In your form
|
130
126
|
builder you declare the textbox normally like so:
|
@@ -146,7 +142,7 @@ This will attach the following presence of error to the :born_on field:
|
|
146
142
|
Date of birth can't be blank.
|
147
143
|
|
148
144
|
|
149
|
-
### Changing Keys
|
145
|
+
### 3. Changing Keys
|
150
146
|
|
151
147
|
Say a User class belongs to an Organization class. In your form, you declare a selector
|
152
148
|
for assigning the organization. The selector is named `:ogranization_id`.
|
@@ -162,7 +158,7 @@ You can solve this problem by changing the key for the attribute like so:
|
|
162
158
|
</script>
|
163
159
|
|
164
160
|
|
165
|
-
### Nested Attributes
|
161
|
+
### 4. Nested Attributes
|
166
162
|
|
167
163
|
You can apply the same principles to nested attributes by nesting the instructions. To return
|
168
164
|
to our father/son example, you can change the name labels for both entities using the following
|
@@ -178,7 +174,7 @@ notation:
|
|
178
174
|
</script>
|
179
175
|
|
180
176
|
|
181
|
-
### Combining Instructions (aka Go Crazy)
|
177
|
+
### 5. Combining Instructions (aka Go Crazy)
|
182
178
|
|
183
179
|
Attribute instructions are provided as hashes so that both `key` and `label` changes can be
|
184
180
|
declared on the same attribute.
|
@@ -187,7 +183,8 @@ Honestly, such instructions are rare in the real world, but error handling can g
|
|
187
183
|
so the library supports it.
|
188
184
|
|
189
185
|
|
190
|
-
|
186
|
+
|
187
|
+
|
191
188
|
## Advanced Usage
|
192
189
|
|
193
190
|
There are a handful of scenarios that fall outside the area of basic usage worth discussing.
|
@@ -223,7 +220,7 @@ using the custom jQuery event `err_supply:unmatched`.
|
|
223
220
|
|
224
221
|
|
225
222
|
|
226
|
-
|
223
|
+
|
227
224
|
## Prerequisites
|
228
225
|
|
229
226
|
* <b>Ruby on Rails:</b> <http://rubyonrails.org>
|
@@ -231,7 +228,7 @@ using the custom jQuery event `err_supply:unmatched`.
|
|
231
228
|
|
232
229
|
|
233
230
|
|
234
|
-
|
231
|
+
|
235
232
|
## Helpful Links
|
236
233
|
|
237
234
|
* <b>Repository:</b> <http://github.com/coroutine/err_supply>
|
@@ -241,7 +238,6 @@ using the custom jQuery event `err_supply:unmatched`.
|
|
241
238
|
|
242
239
|
|
243
240
|
|
244
|
-
***
|
245
241
|
## Gemroll
|
246
242
|
|
247
243
|
Other gems by Coroutine include:
|
@@ -256,7 +252,7 @@ Other gems by Coroutine include:
|
|
256
252
|
|
257
253
|
|
258
254
|
|
259
|
-
|
255
|
+
|
260
256
|
## License
|
261
257
|
|
262
258
|
Copyright (c) 2011 [Coroutine LLC](http://coroutine.com).
|
data/lib/err_supply/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: err_supply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Coroutine
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06-
|
19
|
+
date: 2011-06-14 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|