scratch 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +117 -0
- data/lib/scratch/concerns/nilify.rb +5 -5
- data/lib/scratch/concerns/normalize.rb +21 -21
- data/lib/scratch/utils.rb +9 -0
- data/lib/scratch/version.rb +1 -1
- data/test/dummy/app/models/nilify_test_model.rb +1 -1
- data/test/dummy/app/models/normalize_test_model.rb +18 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120329194042_create_normalize_test_models.rb +9 -0
- data/test/dummy/db/schema.rb +7 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +88 -0
- data/test/dummy/log/test.log +295 -0
- data/test/unit/concerns/nilify_test.rb +2 -2
- data/test/unit/concerns/normalize_test.rb +45 -0
- metadata +28 -11
- data/README.rdoc +0 -3
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# Scratch
|
2
|
+
|
3
|
+
After seeing a presentation (by [Gary Haran]) on Rails engines and
|
4
|
+
reading a [certain blog post], I decided that enough was enough! I had
|
5
|
+
some Rails induced itches that needed some much needed relief. Thus here
|
6
|
+
is Scratch, a library which tries to fix a bunch of Rails' most
|
7
|
+
insignificant shortcomings.
|
8
|
+
|
9
|
+
## Features
|
10
|
+
|
11
|
+
* The normalize model mixin
|
12
|
+
* A few core extensions
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Simply add Scratch to your Gemfile and bundle it up:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'scratch'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### Mixins (or Concerns if you prefer the Rails vocabulary)
|
25
|
+
|
26
|
+
These mixins are included in ActiveRecord with this gem, they could
|
27
|
+
(theoretically) be used inside any other classes, but this hasn't been
|
28
|
+
tested (nor documented) yet.
|
29
|
+
|
30
|
+
#### Normalize
|
31
|
+
|
32
|
+
The `normalize` method help you create callbacks to normalize some
|
33
|
+
attributes in a simple declarative manner.
|
34
|
+
|
35
|
+
Say you'd like to set all blank attributes to nil before validation, you
|
36
|
+
could do:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
normalize before: :validation, when: :blank?, set: nil
|
40
|
+
```
|
41
|
+
|
42
|
+
The `before` option default to `:validation` so it can be omitted in
|
43
|
+
that case. You can also pass a block to `normalize` that will be given
|
44
|
+
the value of the attribute and should return it's normalized form:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
normalize { |value| value.strip }
|
48
|
+
```
|
49
|
+
|
50
|
+
The block in that example is a common pattern that can be replaced by
|
51
|
+
the `method` option:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
normalize method: :strip
|
55
|
+
```
|
56
|
+
|
57
|
+
There's two specialized mixins which are variant of the above
|
58
|
+
examples...
|
59
|
+
|
60
|
+
##### Stripify
|
61
|
+
|
62
|
+
The `stripify` method will strip all attributes, it also support all of
|
63
|
+
normalize options. Here's an example using the `except` option:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
stripify except: :foo
|
67
|
+
```
|
68
|
+
|
69
|
+
##### Nilify
|
70
|
+
|
71
|
+
Don't like odd numbers, here's a solution:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
nilify only: [:foo, :bar], when: :odd?, before: :save
|
75
|
+
```
|
76
|
+
|
77
|
+
### Core Extensions
|
78
|
+
|
79
|
+
#### Array
|
80
|
+
|
81
|
+
Want to use `join` for user facing stuff but doesn't want to clean up
|
82
|
+
the array yourself, use `strip_join`:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
[1, 2, nil, '', ' ' , ' 3 '].strip_join ', '
|
86
|
+
#=> "1, 2, 3"
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Hash
|
90
|
+
|
91
|
+
Have many keys to look-up and need the first one available, use `fetch_or`:
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
h = { a: 1, b: 2, c: 3 }
|
95
|
+
h.fetch_or :e, :d, :c
|
96
|
+
#=> 3
|
97
|
+
# also support a `default` option...
|
98
|
+
h.fetch_or :x, :y, :z, default: nil
|
99
|
+
#=> nil
|
100
|
+
# when no default is given, act like `fetch` and raise a `KeyError`
|
101
|
+
```
|
102
|
+
|
103
|
+
You're stuck with a hash having arrays as values and need to invert it?
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
h = { west_coast: %w(WA OR CA AZ), east_east: %w(ME VT NY NJ) }
|
107
|
+
y = h.invert_splat
|
108
|
+
y['NJ']
|
109
|
+
#=> :east_coast
|
110
|
+
```
|
111
|
+
|
112
|
+
## License
|
113
|
+
|
114
|
+
This project rocks and uses MIT-LICENSE!
|
115
|
+
|
116
|
+
[Gary Haran]: https://github.com/garyharan
|
117
|
+
[certain blog post]: http://gilesbowkett.blogspot.in/2012/02/rails-went-off-rails-why-im-rebuilding.html
|
@@ -7,13 +7,13 @@ module Scratch::Concerns::Nilify
|
|
7
7
|
def nilify(options = {})
|
8
8
|
options = HashWithIndifferentAccess.new options
|
9
9
|
|
10
|
-
options[:before]
|
11
|
-
options[:
|
12
|
-
options[:name]
|
13
|
-
"nilify_before_#{options[:before]}
|
10
|
+
options[:before] ||= :validation
|
11
|
+
options[:when] ||= :blank?
|
12
|
+
options[:name] ||=
|
13
|
+
"nilify_before_#{options[:before]}_when_#{options[:when]}"
|
14
14
|
|
15
15
|
instance_eval do
|
16
|
-
normalize options.merge(
|
16
|
+
normalize options.merge(set: nil)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'scratch/utils'
|
1
2
|
|
2
3
|
# == Normalize Callbacks
|
3
4
|
#
|
@@ -14,12 +15,6 @@ module Scratch::Concerns::Normalize
|
|
14
15
|
if self == ActiveRecord::Base
|
15
16
|
-> base { base.content_columns.map(&:name) }
|
16
17
|
end
|
17
|
-
|
18
|
-
cattr_accessor :normalize_default_callback_format
|
19
|
-
self.normalize_default_callback_format =
|
20
|
-
if self == ActiveRecord::Base
|
21
|
-
'before_%s'
|
22
|
-
end
|
23
18
|
end
|
24
19
|
|
25
20
|
module ClassMethods
|
@@ -27,28 +22,37 @@ module Scratch::Concerns::Normalize
|
|
27
22
|
callback_options = HashWithIndifferentAccess.new options
|
28
23
|
|
29
24
|
options = callback_options.slice!(:if, :unless)
|
30
|
-
|
25
|
+
set = options[:set]
|
31
26
|
method = options[:method]
|
32
|
-
predicate = Array.wrap options[:
|
33
|
-
|
34
|
-
|
27
|
+
predicate = Array.wrap options[:when]
|
28
|
+
|
29
|
+
trigger_format = options[:trigger_format] || '%s_%s'
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
trigger = options[:trigger] ||
|
32
|
+
(options[:before] ? trigger_format % [:before , options[:before]] :
|
33
|
+
options[:after] ? trigger_format % [:after , options[:after]] :
|
34
|
+
raise(ArgumentError, 'missing option, you must specify one of: ' +
|
35
|
+
'before, after or trigger'))
|
36
|
+
|
37
|
+
unless options.has_key?(:set) || method || block_given?
|
38
|
+
raise(ArgumentError, 'missing option or block, ' +
|
39
|
+
'you must give a block or specify one of: set or method')
|
40
|
+
end
|
41
|
+
|
42
|
+
callback = options[:name] || Scratch::Utils.gensym
|
39
43
|
|
40
44
|
attributes = options[:attributes] ||
|
41
45
|
Scratch::Options
|
42
46
|
.except_only(options, normalize_default_attributes_source[self])
|
43
47
|
|
44
48
|
instance_eval do
|
45
|
-
define_method
|
49
|
+
define_method callback do
|
46
50
|
attributes.each do |attribute|
|
47
51
|
value = send(attribute)
|
48
52
|
if predicate.empty? || value.send(*predicate)
|
49
53
|
value =
|
50
|
-
if options.has_key? :
|
51
|
-
|
54
|
+
if options.has_key? :set
|
55
|
+
set
|
52
56
|
elsif method
|
53
57
|
value.send method
|
54
58
|
else
|
@@ -61,11 +65,7 @@ module Scratch::Concerns::Normalize
|
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
64
|
-
|
65
|
-
normalize_default_callback_format
|
66
|
-
|
67
|
-
callback = callback_format ? callback_format % callback : callback
|
68
|
-
send callback, callback_method
|
68
|
+
send trigger, callback
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/scratch/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
class NormalizeTestModel < ActiveRecord::Base
|
3
|
+
|
4
|
+
normalize(after: :save,
|
5
|
+
only: :foo,
|
6
|
+
set: 'foo',
|
7
|
+
name: :normalize_after_save)
|
8
|
+
|
9
|
+
normalize(before: :validation,
|
10
|
+
only: :bar,
|
11
|
+
set: 0)
|
12
|
+
|
13
|
+
normalize(trigger: :before_save,
|
14
|
+
only: :baz) do |value|
|
15
|
+
value * 2
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120329194042) do
|
15
15
|
|
16
16
|
create_table "nilify_test_models", :force => true do |t|
|
17
17
|
t.string "foo"
|
@@ -19,6 +19,12 @@ ActiveRecord::Schema.define(:version => 20120226052737) do
|
|
19
19
|
t.integer "baz"
|
20
20
|
end
|
21
21
|
|
22
|
+
create_table "normalize_test_models", :force => true do |t|
|
23
|
+
t.string "foo"
|
24
|
+
t.integer "bar"
|
25
|
+
t.text "baz"
|
26
|
+
end
|
27
|
+
|
22
28
|
create_table "stripify_test_models", :force => true do |t|
|
23
29
|
t.string "foo"
|
24
30
|
t.string "bar"
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -113,3 +113,91 @@ Migrating to CreateStripifyTestModels (20120226052737)
|
|
113
113
|
[1m[35m (0.3ms)[0m SELECT version FROM "schema_migrations"
|
114
114
|
[1m[36m (29.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20120226052737')[0m
|
115
115
|
[1m[35m (21.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120226002304')
|
116
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
117
|
+
Migrating to CreateNilifyTestModels (20120226002304)
|
118
|
+
Migrating to CreateStripifyTestModels (20120226052737)
|
119
|
+
Migrating to CreateNormalizeTestModels (20120329194042)
|
120
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
121
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
122
|
+
[1m[35m (1.9ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
123
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20120329194042')[0m
|
124
|
+
[1m[35m (36.6ms)[0m commit transaction
|
125
|
+
[1m[36m (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
126
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
127
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("nilify_test_models")[0m
|
128
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("normalize_test_models")
|
129
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("stripify_test_models")[0m
|
130
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
131
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
132
|
+
[1m[36m (30.2ms)[0m [1mCREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) [0m
|
133
|
+
[1m[35m (29.9ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
134
|
+
[1m[36m (29.0ms)[0m [1mCREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) [0m
|
135
|
+
[1m[35m (19.3ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
136
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
137
|
+
[1m[35m (19.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
138
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
139
|
+
[1m[35m (25.3ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
|
140
|
+
[1m[36m (28.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20120226002304')[0m
|
141
|
+
[1m[35m (24.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
|
142
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
143
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
144
|
+
Migrating to CreateNormalizeTestModels (20120329194042)
|
145
|
+
[1m[36m (0.0ms)[0m [1mselect sqlite_version(*)[0m
|
146
|
+
[1m[35m (0.0ms)[0m begin transaction
|
147
|
+
[1m[36m (0.3ms)[0m [1mDROP TABLE "normalize_test_models"[0m
|
148
|
+
[1m[35m (0.1ms)[0m DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20120329194042'
|
149
|
+
[1m[36m (39.3ms)[0m [1mcommit transaction[0m
|
150
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
151
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
152
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("nilify_test_models")
|
153
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("stripify_test_models")[0m
|
154
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
155
|
+
Migrating to CreateNilifyTestModels (20120226002304)
|
156
|
+
Migrating to CreateStripifyTestModels (20120226052737)
|
157
|
+
Migrating to CreateNormalizeTestModels (20120329194042)
|
158
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
159
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
160
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
|
161
|
+
[1m[36m (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20120329194042')[0m
|
162
|
+
[1m[35m (22.6ms)[0m commit transaction
|
163
|
+
[1m[36m (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
164
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
165
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("nilify_test_models")[0m
|
166
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("normalize_test_models")
|
167
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("stripify_test_models")[0m
|
168
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
169
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
170
|
+
[1m[36m (19.8ms)[0m [1mCREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) [0m
|
171
|
+
[1m[35m (15.7ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
|
172
|
+
[1m[36m (27.5ms)[0m [1mCREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) [0m
|
173
|
+
[1m[35m (25.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
174
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
175
|
+
[1m[35m (16.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
176
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
177
|
+
[1m[35m (19.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
|
178
|
+
[1m[36m (27.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20120226002304')[0m
|
179
|
+
[1m[35m (25.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
|
180
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
181
|
+
[1m[35m (0.3ms)[0m select sqlite_version(*)
|
182
|
+
[1m[36m (31.1ms)[0m [1mCREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) [0m
|
183
|
+
[1m[35m (23.5ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
|
184
|
+
[1m[36m (20.5ms)[0m [1mCREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) [0m
|
185
|
+
[1m[35m (24.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
186
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
187
|
+
[1m[35m (26.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
188
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
189
|
+
[1m[35m (21.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
|
190
|
+
[1m[36m (16.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20120226002304')[0m
|
191
|
+
[1m[35m (28.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
|
192
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
193
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
194
|
+
[1m[36m (29.5ms)[0m [1mCREATE TABLE "nilify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255), "baz" integer) [0m
|
195
|
+
[1m[35m (24.8ms)[0m CREATE TABLE "normalize_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" integer, "baz" text)
|
196
|
+
[1m[36m (18.6ms)[0m [1mCREATE TABLE "stripify_test_models" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "foo" varchar(255), "bar" varchar(255)) [0m
|
197
|
+
[1m[35m (28.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
198
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
199
|
+
[1m[35m (25.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
200
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
201
|
+
[1m[35m (17.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120329194042')
|
202
|
+
[1m[36m (17.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20120226002304')[0m
|
203
|
+
[1m[35m (24.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20120226052737')
|
data/test/dummy/log/test.log
CHANGED
@@ -292,3 +292,298 @@
|
|
292
292
|
[1m[35mSQL (26.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 22
|
293
293
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
294
294
|
[1m[35m (0.0ms)[0m rollback transaction
|
295
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
296
|
+
[1m[35mSQL (4.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
297
|
+
[1m[36m (42.4ms)[0m [1mcommit transaction[0m
|
298
|
+
[1m[35mSQL (23.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 23
|
299
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
300
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
301
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
302
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
303
|
+
[1m[36m (25.0ms)[0m [1mcommit transaction[0m
|
304
|
+
[1m[35mSQL (16.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 24
|
305
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
306
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
307
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
308
|
+
[1m[35mSQL (3.0ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
309
|
+
[1m[36m (28.6ms)[0m [1mcommit transaction[0m
|
310
|
+
[1m[35mSQL (27.6ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 25
|
311
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
312
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
313
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
314
|
+
[1m[35mSQL (3.4ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
315
|
+
[1m[36m (29.6ms)[0m [1mcommit transaction[0m
|
316
|
+
[1m[35mSQL (27.6ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 1
|
317
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
318
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
319
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
320
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
321
|
+
[1m[36m (21.3ms)[0m [1mcommit transaction[0m
|
322
|
+
[1m[35mSQL (25.0ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 2
|
323
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
324
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
|
325
|
+
[1m[36m (27.1ms)[0m [1mcommit transaction[0m
|
326
|
+
[1m[35mSQL (22.2ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 1
|
327
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
328
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
329
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
330
|
+
[1m[35mSQL (2.7ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
331
|
+
[1m[36m (25.9ms)[0m [1mcommit transaction[0m
|
332
|
+
[1m[35mSQL (18.0ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 3
|
333
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
334
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
|
335
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
336
|
+
[1m[35m (0.1ms)[0m begin transaction
|
337
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
338
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
339
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
340
|
+
[1m[36m (22.6ms)[0m [1mcommit transaction[0m
|
341
|
+
[1m[35mSQL (17.0ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 4
|
342
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
343
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
|
344
|
+
[1m[36m (27.1ms)[0m [1mcommit transaction[0m
|
345
|
+
[1m[35mSQL (27.0ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 2
|
346
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
347
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
348
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
349
|
+
[1m[35mSQL (3.3ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
350
|
+
[1m[36m (33.1ms)[0m [1mcommit transaction[0m
|
351
|
+
[1m[35mSQL (26.0ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 5
|
352
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
353
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
|
354
|
+
[1m[36m (21.6ms)[0m [1mcommit transaction[0m
|
355
|
+
[1m[35mSQL (15.5ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 3
|
356
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
357
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
358
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
359
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
360
|
+
[1m[36m (30.0ms)[0m [1mcommit transaction[0m
|
361
|
+
[1m[35mSQL (25.0ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 6
|
362
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
363
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 1], ["baz", ""], ["foo", ""]]
|
364
|
+
[1m[36m (17.5ms)[0m [1mcommit transaction[0m
|
365
|
+
[1m[35mSQL (17.6ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 4
|
366
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
367
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
368
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
369
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
370
|
+
[1m[36m (23.9ms)[0m [1mcommit transaction[0m
|
371
|
+
[1m[35mSQL (30.7ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 7
|
372
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
373
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
374
|
+
[1m[36m (24.4ms)[0m [1mcommit transaction[0m
|
375
|
+
[1m[35mSQL (17.3ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 5
|
376
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
377
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
378
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
379
|
+
[1m[35mSQL (2.8ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
380
|
+
[1m[36m (31.1ms)[0m [1mcommit transaction[0m
|
381
|
+
[1m[35mSQL (25.6ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 8
|
382
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
383
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
384
|
+
[1m[36m (17.1ms)[0m [1mcommit transaction[0m
|
385
|
+
[1m[35mSQL (16.2ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 6
|
386
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
387
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
388
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
389
|
+
[1m[35mSQL (2.4ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
390
|
+
[1m[36m (30.5ms)[0m [1mcommit transaction[0m
|
391
|
+
[1m[35mSQL (27.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 9
|
392
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
393
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
394
|
+
[1m[36m (22.4ms)[0m [1mcommit transaction[0m
|
395
|
+
[1m[35mSQL (16.5ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 7
|
396
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
397
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
398
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
399
|
+
[1m[35mSQL (2.6ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
400
|
+
[1m[36m (22.4ms)[0m [1mcommit transaction[0m
|
401
|
+
[1m[35mSQL (27.2ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 10
|
402
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
403
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
404
|
+
[1m[36m (25.1ms)[0m [1mcommit transaction[0m
|
405
|
+
[1m[35mSQL (21.0ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 8
|
406
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
407
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
408
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
409
|
+
[1m[35mSQL (2.0ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
410
|
+
[1m[36m (25.7ms)[0m [1mcommit transaction[0m
|
411
|
+
[1m[35mSQL (26.8ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 11
|
412
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
413
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
414
|
+
[1m[36m (26.2ms)[0m [1mcommit transaction[0m
|
415
|
+
[1m[35mSQL (17.1ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 9
|
416
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
417
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
418
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
419
|
+
[1m[35mSQL (2.4ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
420
|
+
[1m[36m (21.6ms)[0m [1mcommit transaction[0m
|
421
|
+
[1m[35mSQL (23.7ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 12
|
422
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
423
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
424
|
+
[1m[36m (28.9ms)[0m [1mcommit transaction[0m
|
425
|
+
[1m[35mSQL (26.1ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 10
|
426
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
427
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
428
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
429
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
430
|
+
[1m[36m (26.5ms)[0m [1mcommit transaction[0m
|
431
|
+
[1m[35mSQL (16.4ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 13
|
432
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
433
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
434
|
+
[1m[36m (16.3ms)[0m [1mcommit transaction[0m
|
435
|
+
[1m[35mSQL (29.0ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 11
|
436
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
437
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
438
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
439
|
+
[1m[35mSQL (2.9ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
440
|
+
[1m[36m (26.7ms)[0m [1mcommit transaction[0m
|
441
|
+
[1m[35mSQL (28.9ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 14
|
442
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
443
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
444
|
+
[1m[36m (25.1ms)[0m [1mcommit transaction[0m
|
445
|
+
[1m[35mSQL (18.3ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 12
|
446
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
447
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
448
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
449
|
+
[1m[35mSQL (2.6ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
450
|
+
[1m[36m (25.4ms)[0m [1mcommit transaction[0m
|
451
|
+
[1m[35mSQL (26.6ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 15
|
452
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
453
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", ""], ["foo", ""]]
|
454
|
+
[1m[36m (24.9ms)[0m [1mcommit transaction[0m
|
455
|
+
[1m[35mSQL (20.8ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 13
|
456
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
457
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
458
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
459
|
+
[1m[35mSQL (2.6ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
460
|
+
[1m[36m (21.0ms)[0m [1mcommit transaction[0m
|
461
|
+
[1m[35mSQL (28.9ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 16
|
462
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
463
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
464
|
+
[1m[36m (25.1ms)[0m [1mcommit transaction[0m
|
465
|
+
[1m[35mSQL (17.8ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 14
|
466
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
467
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
468
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
469
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
470
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
471
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
472
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
473
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
474
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
475
|
+
[1m[35mSQL (2.2ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
476
|
+
[1m[36m (43.7ms)[0m [1mcommit transaction[0m
|
477
|
+
[1m[35mSQL (27.7ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 17
|
478
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
479
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
480
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
481
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
482
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
483
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
484
|
+
[1m[36m (30.1ms)[0m [1mcommit transaction[0m
|
485
|
+
[1m[35mSQL (19.5ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 18
|
486
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
487
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
488
|
+
[1m[36m (17.0ms)[0m [1mcommit transaction[0m
|
489
|
+
[1m[35mSQL (22.6ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 15
|
490
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
491
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
492
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
493
|
+
[1m[35mSQL (2.6ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
494
|
+
[1m[36m (24.3ms)[0m [1mcommit transaction[0m
|
495
|
+
[1m[35mSQL (21.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 19
|
496
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
497
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
498
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
499
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
500
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
501
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
502
|
+
[1m[36m (25.5ms)[0m [1mcommit transaction[0m
|
503
|
+
[1m[35mSQL (19.2ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 20
|
504
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
505
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
506
|
+
[1m[36m (28.3ms)[0m [1mcommit transaction[0m
|
507
|
+
[1m[35mSQL (24.0ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 16
|
508
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
509
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
510
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
511
|
+
[1m[35mSQL (3.3ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
|
512
|
+
[1m[36m (38.8ms)[0m [1mcommit transaction[0m
|
513
|
+
[1m[35mSQL (18.9ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 21
|
514
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
515
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
516
|
+
[1m[36m (16.3ms)[0m [1mcommit transaction[0m
|
517
|
+
[1m[35mSQL (20.6ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 17
|
518
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
519
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
520
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
521
|
+
[1m[35mSQL (3.1ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
|
522
|
+
[1m[36m (33.8ms)[0m [1mcommit transaction[0m
|
523
|
+
[1m[35mSQL (17.1ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 22
|
524
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
525
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
526
|
+
[1m[36m (27.3ms)[0m [1mcommit transaction[0m
|
527
|
+
[1m[35mSQL (28.3ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 18
|
528
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
529
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
530
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
531
|
+
[1m[35mSQL (2.7ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
|
532
|
+
[1m[36m (32.6ms)[0m [1mcommit transaction[0m
|
533
|
+
[1m[35mSQL (25.4ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 23
|
534
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
535
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
536
|
+
[1m[36m (23.0ms)[0m [1mcommit transaction[0m
|
537
|
+
[1m[35mSQL (26.1ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 19
|
538
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
539
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
540
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
541
|
+
[1m[35mSQL (2.6ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", 1], ["foo", ""]]
|
542
|
+
[1m[36m (29.1ms)[0m [1mcommit transaction[0m
|
543
|
+
[1m[35mSQL (22.2ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 24
|
544
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
545
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
546
|
+
[1m[36m (21.0ms)[0m [1mcommit transaction[0m
|
547
|
+
[1m[35mSQL (14.6ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 20
|
548
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
549
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
550
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
551
|
+
[1m[35mSQL (3.1ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
552
|
+
[1m[36m (29.3ms)[0m [1mcommit transaction[0m
|
553
|
+
[1m[35mSQL (22.5ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 25
|
554
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
555
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
556
|
+
[1m[36m (22.4ms)[0m [1mcommit transaction[0m
|
557
|
+
[1m[35mSQL (15.2ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 21
|
558
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
559
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
560
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
561
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
562
|
+
[1m[36m (20.0ms)[0m [1mcommit transaction[0m
|
563
|
+
[1m[35mSQL (25.5ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 26
|
564
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
565
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
566
|
+
[1m[36m (26.5ms)[0m [1mcommit transaction[0m
|
567
|
+
[1m[35mSQL (23.0ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 22
|
568
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
569
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
570
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
571
|
+
[1m[35mSQL (16.5ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
572
|
+
[1m[36m (45.9ms)[0m [1mcommit transaction[0m
|
573
|
+
[1m[35mSQL (17.3ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 27
|
574
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
575
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
576
|
+
[1m[36m (15.4ms)[0m [1mcommit transaction[0m
|
577
|
+
[1m[35mSQL (26.5ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 23
|
578
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
579
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
580
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
581
|
+
[1m[35mSQL (3.0ms)[0m INSERT INTO "nilify_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", nil], ["baz", nil], ["foo", ""]]
|
582
|
+
[1m[36m (45.8ms)[0m [1mcommit transaction[0m
|
583
|
+
[1m[35mSQL (17.4ms)[0m DELETE FROM "nilify_test_models" WHERE "nilify_test_models"."id" = 28
|
584
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
585
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "normalize_test_models" ("bar", "baz", "foo") VALUES (?, ?, ?) [["bar", 0], ["baz", "!!"], ["foo", ""]]
|
586
|
+
[1m[36m (22.9ms)[0m [1mcommit transaction[0m
|
587
|
+
[1m[35mSQL (28.9ms)[0m DELETE FROM "normalize_test_models" WHERE "normalize_test_models"."id" = 24
|
588
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
589
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -13,8 +13,8 @@ class Scratch::Concerns::NilifyTest < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_callbacks_methods_are_defined
|
16
|
-
|
17
|
-
|
16
|
+
assert_respond_to @entity, :nilify_before_validation_when_blank?
|
17
|
+
assert_respond_to @entity, :nilify_before_save_when_odd?
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_effect_of_triggering_validation_callback
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../../test_helper.rb'
|
4
|
+
|
5
|
+
class Scratch::Concerns::NormalizeTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@entity = NormalizeTestModel.new foo: '', bar: 1, baz: '!'
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
@entity.delete
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_must_specify_a_trigger_for_normalize
|
16
|
+
assert_raise ArgumentError do
|
17
|
+
NormalizeTestModel.class_eval { normalize }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_must_specify_an_action_for_normalize
|
22
|
+
assert_raise ArgumentError do
|
23
|
+
NormalizeTestModel.class_eval { normalize trigger: :foo }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_callbacks_methods_are_defined
|
28
|
+
assert_respond_to @entity, :normalize_after_save
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_effect_of_triggering_validation_callback
|
32
|
+
@entity.valid?
|
33
|
+
assert_equal '', @entity.foo
|
34
|
+
assert_equal 0 , @entity.bar
|
35
|
+
assert_equal '!', @entity.baz
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_effect_of_triggering_save_callback
|
39
|
+
@entity.save
|
40
|
+
assert_equal 'foo', @entity.foo
|
41
|
+
assert_equal 0 , @entity.bar
|
42
|
+
assert_equal '!!', @entity.baz
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scratch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.2.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.1
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: sqlite3
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,8 +37,13 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: See README.md file.
|
37
47
|
email:
|
38
48
|
- nbuduroi@gmail.com
|
39
49
|
executables: []
|
@@ -56,12 +66,14 @@ files:
|
|
56
66
|
- lib/scratch/core_ext/hash.rb
|
57
67
|
- lib/scratch/concerns.rb
|
58
68
|
- lib/scratch/options.rb
|
69
|
+
- lib/scratch/utils.rb
|
59
70
|
- lib/scratch/engine.rb
|
60
71
|
- lib/tasks/scratch_tasks.rake
|
61
72
|
- MIT-LICENSE
|
62
73
|
- Rakefile
|
63
|
-
- README.
|
74
|
+
- README.md
|
64
75
|
- test/unit/concerns/nilify_test.rb
|
76
|
+
- test/unit/concerns/normalize_test.rb
|
65
77
|
- test/unit/concerns/stripify_test.rb
|
66
78
|
- test/unit/core_ext/array_test.rb
|
67
79
|
- test/unit/core_ext/hash_test.rb
|
@@ -96,7 +108,9 @@ files:
|
|
96
108
|
- test/dummy/db/test.sqlite3
|
97
109
|
- test/dummy/db/migrate/20120226002304_create_nilify_test_models.rb
|
98
110
|
- test/dummy/db/migrate/20120226052737_create_stripify_test_models.rb
|
111
|
+
- test/dummy/db/migrate/20120329194042_create_normalize_test_models.rb
|
99
112
|
- test/dummy/app/models/nilify_test_model.rb
|
113
|
+
- test/dummy/app/models/normalize_test_model.rb
|
100
114
|
- test/dummy/app/models/stripify_test_model.rb
|
101
115
|
- test/dummy/app/helpers/application_helper.rb
|
102
116
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -119,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
133
|
version: '0'
|
120
134
|
segments:
|
121
135
|
- 0
|
122
|
-
hash:
|
136
|
+
hash: -2245081140959681315
|
123
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
138
|
none: false
|
125
139
|
requirements:
|
@@ -128,15 +142,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
142
|
version: '0'
|
129
143
|
segments:
|
130
144
|
- 0
|
131
|
-
hash:
|
145
|
+
hash: -2245081140959681315
|
132
146
|
requirements: []
|
133
147
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.8.
|
148
|
+
rubygems_version: 1.8.22
|
135
149
|
signing_key:
|
136
150
|
specification_version: 3
|
137
151
|
summary: A plugin to relieve from some Rails itches.
|
138
152
|
test_files:
|
139
153
|
- test/unit/concerns/nilify_test.rb
|
154
|
+
- test/unit/concerns/normalize_test.rb
|
140
155
|
- test/unit/concerns/stripify_test.rb
|
141
156
|
- test/unit/core_ext/array_test.rb
|
142
157
|
- test/unit/core_ext/hash_test.rb
|
@@ -171,7 +186,9 @@ test_files:
|
|
171
186
|
- test/dummy/db/test.sqlite3
|
172
187
|
- test/dummy/db/migrate/20120226002304_create_nilify_test_models.rb
|
173
188
|
- test/dummy/db/migrate/20120226052737_create_stripify_test_models.rb
|
189
|
+
- test/dummy/db/migrate/20120329194042_create_normalize_test_models.rb
|
174
190
|
- test/dummy/app/models/nilify_test_model.rb
|
191
|
+
- test/dummy/app/models/normalize_test_model.rb
|
175
192
|
- test/dummy/app/models/stripify_test_model.rb
|
176
193
|
- test/dummy/app/helpers/application_helper.rb
|
177
194
|
- test/dummy/app/assets/stylesheets/application.css
|
data/README.rdoc
DELETED