consistency_fail 0.2.0 → 0.2.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.
- data/README.md +24 -7
- data/lib/consistency_fail/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -14,22 +14,31 @@ stop ignoring the C in ACID.
|
|
14
14
|
Similar problems arise with `has_one`, so consistency\_fail finds places where
|
15
15
|
database-level enforcement is lacking there as well.
|
16
16
|
|
17
|
+
For more detail, see [my blog post on the
|
18
|
+
subject](http://blog.8thlight.com/articles/2011/6/11/winning-at-consistency).
|
17
19
|
|
18
20
|
## Installation
|
19
21
|
|
22
|
+
For Rails 3:
|
23
|
+
|
20
24
|
gem install consistency_fail
|
21
25
|
|
26
|
+
For Rails 2.3:
|
27
|
+
|
28
|
+
gem install consistency_fail -v=0.1.0
|
29
|
+
|
22
30
|
## Limitations
|
23
31
|
|
24
32
|
consistency\_fail depends on being able to find all your `ActiveRecord::Base`
|
25
33
|
subclasses with some `$LOAD_PATH` trickery. If any models are in a path either
|
26
34
|
not on your project's load path or in a path that doesn't include the word
|
27
|
-
"models", consistency\_fail won't be able to find or analyze them.
|
35
|
+
"models", consistency\_fail won't be able to find or analyze them. I'm open to
|
36
|
+
making the text "models" configurable if people want that.
|
28
37
|
|
29
38
|
## Usage
|
30
39
|
|
31
|
-
The
|
32
|
-
|
40
|
+
The normal run mode is to generate a report of the problematic spots in your
|
41
|
+
application. From your Rails project directory, run:
|
33
42
|
|
34
43
|
consistency_fail
|
35
44
|
|
@@ -38,11 +47,19 @@ you can view directly, redirect to a file as evidence to embarrass a teammate,
|
|
38
47
|
or simply beam in happiness at your application's perfect record for
|
39
48
|
`validates_uniqueness_of` and `has_one` usage.
|
40
49
|
|
41
|
-
|
50
|
+
The somewhat more sinister and awesome run mode is to include an initializer
|
51
|
+
that does this:
|
52
|
+
|
53
|
+
require 'consistency_fail/enforcer'
|
54
|
+
ConsistencyFail::Enforcer.enforce!
|
55
|
+
|
56
|
+
This will make it so that you can't save or load any ActiveRecord models until
|
57
|
+
you go back and add your unique indexes. Of course, you'll need to make it so
|
58
|
+
Rails can find `consistency_fail/enforcer` by having `consistency_fail` in your
|
59
|
+
Gemfile, or by some other mechanism.
|
42
60
|
|
43
|
-
|
44
|
-
|
45
|
-
* Super-fail mode that monkey-patches explosions into your naughty models
|
61
|
+
This mega-fail mode is nice to have if you have a large team and want to ensure
|
62
|
+
that new models or validations/associations follow the rules.
|
46
63
|
|
47
64
|
## License
|
48
65
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consistency_fail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Colin Jones
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-17 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|