auto_build 0.0.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/auto_build.rb +2 -0
- data/lib/auto_build/association.rb +2 -25
- data/lib/auto_build/has_many_hook.rb +28 -0
- data/lib/auto_build/has_one_hook.rb +23 -0
- data/lib/auto_build/version.rb +1 -1
- data/test/dummy/log/test.log +268 -0
- metadata +9 -9
data/README.md
CHANGED
data/lib/auto_build.rb
CHANGED
@@ -58,37 +58,14 @@ module AutoBuild
|
|
58
58
|
# It will choose the correct hook based on the value of `type`.
|
59
59
|
def add_hook
|
60
60
|
if type == :has_one
|
61
|
-
|
61
|
+
HasOneHook.new(model, association_name).attach
|
62
62
|
else
|
63
|
-
|
63
|
+
HasManyHook.new(model, association_name, options).attach
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
-
def has_one_hook
|
70
|
-
code = "self.#{association_name} ||= build_#{association_name}"
|
71
|
-
|
72
|
-
model.class_eval do
|
73
|
-
after_initialize do |record|
|
74
|
-
record.instance_eval(code)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def has_many_hook
|
80
|
-
name = association_name
|
81
|
-
record_options = options
|
82
|
-
code = "self.#{association_name}.build;"
|
83
|
-
|
84
|
-
model.class_eval do
|
85
|
-
after_initialize do |record|
|
86
|
-
count = number_of_records_to_create(name, record_options)
|
87
|
-
record.instance_eval(code * count)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
69
|
def validate_options
|
93
70
|
if options[:count] && options[:append]
|
94
71
|
raise AutoBuildError.new("You can't specify :count and :append at the same time")
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module AutoBuild
|
2
|
+
class HasManyHook
|
3
|
+
attr_reader :model, :association_name, :options
|
4
|
+
|
5
|
+
def initialize(model, name, options)
|
6
|
+
@model = model
|
7
|
+
@association_name = name
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def attach
|
12
|
+
hook_code = code
|
13
|
+
name = association_name
|
14
|
+
record_options = options
|
15
|
+
|
16
|
+
model.class_eval do
|
17
|
+
after_initialize do |record|
|
18
|
+
count = number_of_records_to_create(name, record_options)
|
19
|
+
record.instance_eval(hook_code * count)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def code
|
25
|
+
"self.#{association_name}.build;"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AutoBuild
|
2
|
+
class HasOneHook
|
3
|
+
attr_reader :model, :association_name
|
4
|
+
|
5
|
+
def initialize(model, name)
|
6
|
+
@model = model
|
7
|
+
@association_name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def attach
|
11
|
+
hook_code = code
|
12
|
+
model.class_eval do
|
13
|
+
after_initialize do |record|
|
14
|
+
record.instance_eval(hook_code)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def code
|
20
|
+
"self.#{association_name} ||= build_#{association_name}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/auto_build/version.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -33613,3 +33613,271 @@ Migrating to CreatePhones (20111211213814)
|
|
33613
33613
|
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33614
33614
|
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33615
33615
|
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33616
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33617
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33618
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33619
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33620
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33621
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33622
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33623
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33624
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33625
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33626
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
33627
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33628
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33629
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33630
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33631
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33632
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33633
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
33634
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33635
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33636
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33637
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33638
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33639
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33640
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33641
|
+
[1m[35mSQL (9.8ms)[0m INSERT INTO "addresses" ("city", "created_at", "street", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["city", nil], ["created_at", Fri, 16 Dec 2011 22:25:49 UTC +00:00], ["street", "Highway 61"], ["updated_at", Fri, 16 Dec 2011 22:25:49 UTC +00:00], ["user_id", nil]]
|
33642
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33643
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33644
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33645
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33646
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33647
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33648
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33649
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33650
|
+
[1m[36mSQL (1.2ms)[0m [1mINSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["name", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00]]
|
33651
|
+
[1m[35m (0.2ms)[0m UPDATE "addresses" SET "user_id" = 1, "updated_at" = '2011-12-16 22:25:50.016087' WHERE "addresses"."id" = 1
|
33652
|
+
[1m[36mSQL (0.8ms)[0m [1mINSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["path", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33653
|
+
[1m[35mSQL (0.7ms)[0m INSERT INTO "projects" ("created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["title", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33654
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33655
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33656
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33657
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
33658
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1[0m
|
33659
|
+
[1m[35mAddress Load (0.1ms)[0m SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
|
33660
|
+
[1m[36mPicture Load (0.1ms)[0m [1mSELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1[0m
|
33661
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33662
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1[0m
|
33663
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33664
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33665
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33666
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33667
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33668
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33669
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33670
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33671
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33672
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33673
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33674
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33675
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33676
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33677
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33678
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33679
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33680
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33681
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33682
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33683
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33684
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33685
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33686
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33687
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33688
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33689
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33690
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33691
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33692
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33693
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33694
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33695
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33696
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["name", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00]]
|
33697
|
+
[1m[35mSQL (3.6ms)[0m INSERT INTO "addresses" ("city", "created_at", "street", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["city", nil], ["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["street", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33698
|
+
[1m[36mSQL (0.7ms)[0m [1mINSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["path", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33699
|
+
[1m[35mSQL (0.6ms)[0m INSERT INTO "projects" ("created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["title", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33700
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33701
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33702
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:25:50 UTC +00:00], ["user_id", 1]]
|
33703
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
33704
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1[0m
|
33705
|
+
[1m[35mAddress Load (0.1ms)[0m SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
|
33706
|
+
[1m[36mPicture Load (0.1ms)[0m [1mSELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1[0m
|
33707
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33708
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1[0m
|
33709
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33710
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33711
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33712
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33713
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33714
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33715
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33716
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33717
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33718
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33719
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33720
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33721
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33722
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33723
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33724
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33725
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33726
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33727
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33728
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33729
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33730
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33731
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33732
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33733
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33734
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33735
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33736
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33737
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33738
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33739
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33740
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33741
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33742
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33743
|
+
[1m[35mSQL (4.9ms)[0m INSERT INTO "addresses" ("city", "created_at", "street", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["city", nil], ["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["street", "Highway 61"], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", nil]]
|
33744
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33745
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33746
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33747
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33748
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33749
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33750
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33751
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33752
|
+
[1m[36mSQL (0.8ms)[0m [1mINSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["name", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00]]
|
33753
|
+
[1m[35m (0.2ms)[0m UPDATE "addresses" SET "user_id" = 1, "updated_at" = '2011-12-16 22:28:30.275169' WHERE "addresses"."id" = 1
|
33754
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["path", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33755
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "projects" ("created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["title", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33756
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33757
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33758
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33759
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
33760
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1[0m
|
33761
|
+
[1m[35mAddress Load (0.1ms)[0m SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
|
33762
|
+
[1m[36mPicture Load (0.1ms)[0m [1mSELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1[0m
|
33763
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33764
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1[0m
|
33765
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33766
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33767
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33768
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33769
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33770
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33771
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33772
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33773
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33774
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33775
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33776
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33777
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33778
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33779
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33780
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33781
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33782
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33783
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33784
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33785
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33786
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33787
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33788
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33789
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33790
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33791
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33792
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33793
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33794
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33795
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
33796
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
33797
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
33798
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["name", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00]]
|
33799
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "addresses" ("city", "created_at", "street", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["city", nil], ["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["street", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33800
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["path", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33801
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "projects" ("created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["title", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33802
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33803
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33804
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "nicknames" ("created_at", "nick", "updated_at", "user_id") VALUES (?, ?, ?, ?)[0m [["created_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["nick", nil], ["updated_at", Fri, 16 Dec 2011 22:28:30 UTC +00:00], ["user_id", 1]]
|
33805
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
33806
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1[0m
|
33807
|
+
[1m[35mAddress Load (0.1ms)[0m SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
|
33808
|
+
[1m[36mPicture Load (0.1ms)[0m [1mSELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1[0m
|
33809
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33810
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1[0m
|
33811
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
|
33812
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33813
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33814
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33815
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33816
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33817
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33818
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33819
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33820
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33821
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
33822
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33823
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33824
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33825
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33826
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33827
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33828
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33829
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33830
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33831
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33832
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33833
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33834
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33835
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33836
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33837
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33838
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33839
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33840
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33841
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33842
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33843
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33844
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33845
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33846
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33847
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33848
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33849
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33850
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33851
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33852
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33853
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33854
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33855
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33856
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33857
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33858
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33859
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33860
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33861
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33862
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33863
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33864
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33865
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33866
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33867
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33868
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33869
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33870
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33871
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33872
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33873
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33874
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33875
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33876
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
33877
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33878
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33879
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33880
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33881
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
33882
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
33883
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-12-16 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
17
|
-
requirement: &
|
16
|
+
requirement: &70179119875860 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: 3.1.3
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *70179119875860
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: sqlite3
|
28
|
-
requirement: &
|
27
|
+
requirement: &70179119875200 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ! '>='
|
@@ -33,7 +32,7 @@ dependencies:
|
|
33
32
|
version: '0'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *70179119875200
|
37
36
|
description: Automatically initialize associations in Rails models
|
38
37
|
email:
|
39
38
|
- federico.builes@gmail.com
|
@@ -43,6 +42,8 @@ extra_rdoc_files: []
|
|
43
42
|
files:
|
44
43
|
- lib/auto_build/association.rb
|
45
44
|
- lib/auto_build/builder.rb
|
45
|
+
- lib/auto_build/has_many_hook.rb
|
46
|
+
- lib/auto_build/has_one_hook.rb
|
46
47
|
- lib/auto_build/version.rb
|
47
48
|
- lib/auto_build.rb
|
48
49
|
- lib/tasks/auto_build_tasks.rake
|
@@ -107,7 +108,6 @@ files:
|
|
107
108
|
- test/dummy/test/unit/project_test.rb
|
108
109
|
- test/dummy/test/unit/user_test.rb
|
109
110
|
- test/test_helper.rb
|
110
|
-
has_rdoc: true
|
111
111
|
homepage: https://github.com/febuiles/auto_build
|
112
112
|
licenses: []
|
113
113
|
post_install_message:
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
131
|
+
rubygems_version: 1.8.10
|
132
132
|
signing_key:
|
133
133
|
specification_version: 3
|
134
134
|
summary: Automatically initialize associations in Rails models
|