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 CHANGED
@@ -1,7 +1,7 @@
1
1
  AutoBuild
2
2
  =========
3
3
 
4
- Automatically initialize associations in your Rails models.
4
+ Automatically initialize associations in your Rails 3 models.
5
5
 
6
6
  What
7
7
  ----
data/lib/auto_build.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'auto_build/builder'
2
+ require 'auto_build/has_one_hook'
3
+ require 'auto_build/has_many_hook'
2
4
  require 'auto_build/association'
3
5
  require 'auto_build/version'
4
6
 
@@ -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
- has_one_hook
61
+ HasOneHook.new(model, association_name).attach
62
62
  else
63
- has_many_hook
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
@@ -1,3 +1,3 @@
1
1
  module AutoBuild
2
- VERSION = "0.0.4"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -33613,3 +33613,271 @@ Migrating to CreatePhones (20111211213814)
33613
33613
   (0.0ms) RELEASE SAVEPOINT active_record_1
33614
33614
   (0.0ms) SAVEPOINT active_record_1
33615
33615
   (0.0ms) RELEASE SAVEPOINT active_record_1
33616
+  (0.1ms) SAVEPOINT active_record_1
33617
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33618
+  (0.0ms) SAVEPOINT active_record_1
33619
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33620
+  (0.1ms) SAVEPOINT active_record_1
33621
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33622
+  (0.0ms) SAVEPOINT active_record_1
33623
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33624
+  (0.0ms) SAVEPOINT active_record_1
33625
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33626
+  (0.2ms) SAVEPOINT active_record_1
33627
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33628
+  (0.0ms) SAVEPOINT active_record_1
33629
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33630
+  (0.0ms) SAVEPOINT active_record_1
33631
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33632
+  (0.0ms) SAVEPOINT active_record_1
33633
+  (0.2ms) RELEASE SAVEPOINT active_record_1
33634
+  (0.0ms) SAVEPOINT active_record_1
33635
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33636
+  (0.0ms) SAVEPOINT active_record_1
33637
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33638
+  (0.0ms) SAVEPOINT active_record_1
33639
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33640
+  (0.0ms) SAVEPOINT active_record_1
33641
+ SQL (9.8ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33643
+  (0.1ms) SAVEPOINT active_record_1
33644
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33645
+  (0.0ms) SAVEPOINT active_record_1
33646
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33647
+  (0.0ms) SAVEPOINT active_record_1
33648
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33649
+  (0.1ms) SAVEPOINT active_record_1
33650
+ SQL (1.2ms) INSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["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
+  (0.2ms) UPDATE "addresses" SET "user_id" = 1, "updated_at" = '2011-12-16 22:25:50.016087' WHERE "addresses"."id" = 1
33652
+ SQL (0.8ms) INSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["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
+ SQL (0.7ms) 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
+ SQL (0.6ms) 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]]
33655
+ SQL (0.3ms) 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
+ SQL (0.3ms) 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]]
33657
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33658
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
33659
+ Address Load (0.1ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
33660
+ Picture Load (0.1ms) SELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1
33661
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33662
+  (0.1ms) SELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1
33663
+  (0.0ms) SAVEPOINT active_record_1
33664
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33665
+  (0.0ms) SAVEPOINT active_record_1
33666
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33667
+  (0.0ms) SAVEPOINT active_record_1
33668
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33669
+  (0.0ms) SAVEPOINT active_record_1
33670
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33671
+  (0.1ms) SAVEPOINT active_record_1
33672
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33673
+  (0.0ms) SAVEPOINT active_record_1
33674
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33675
+  (0.0ms) SAVEPOINT active_record_1
33676
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33677
+  (0.0ms) SAVEPOINT active_record_1
33678
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33679
+  (0.1ms) SAVEPOINT active_record_1
33680
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33681
+  (0.0ms) SAVEPOINT active_record_1
33682
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33683
+  (0.0ms) SAVEPOINT active_record_1
33684
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33685
+  (0.0ms) SAVEPOINT active_record_1
33686
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33687
+  (0.0ms) SAVEPOINT active_record_1
33688
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33689
+  (0.0ms) SAVEPOINT active_record_1
33690
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33691
+  (0.0ms) SAVEPOINT active_record_1
33692
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33693
+  (0.0ms) SAVEPOINT active_record_1
33694
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33695
+  (0.0ms) SAVEPOINT active_record_1
33696
+ SQL (0.6ms) INSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["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
+ SQL (3.6ms) 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
+ SQL (0.7ms) INSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["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
+ SQL (0.6ms) 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
+ SQL (0.5ms) 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]]
33701
+ SQL (0.4ms) 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
+ SQL (0.5ms) 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]]
33703
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33704
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
33705
+ Address Load (0.1ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
33706
+ Picture Load (0.1ms) SELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1
33707
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33708
+  (0.1ms) SELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1
33709
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33710
+  (0.0ms) SAVEPOINT active_record_1
33711
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33712
+  (0.0ms) SAVEPOINT active_record_1
33713
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33714
+  (0.0ms) SAVEPOINT active_record_1
33715
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33716
+  (0.0ms) SAVEPOINT active_record_1
33717
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33718
+  (0.1ms) SAVEPOINT active_record_1
33719
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33720
+  (0.0ms) SAVEPOINT active_record_1
33721
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33722
+  (0.1ms) SAVEPOINT active_record_1
33723
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33724
+  (0.0ms) SAVEPOINT active_record_1
33725
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33726
+  (0.0ms) SAVEPOINT active_record_1
33727
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33728
+  (0.0ms) SAVEPOINT active_record_1
33729
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33730
+  (0.0ms) SAVEPOINT active_record_1
33731
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33732
+  (0.0ms) SAVEPOINT active_record_1
33733
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33734
+  (0.0ms) SAVEPOINT active_record_1
33735
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33736
+  (0.0ms) SAVEPOINT active_record_1
33737
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33738
+  (0.0ms) SAVEPOINT active_record_1
33739
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33740
+  (0.0ms) SAVEPOINT active_record_1
33741
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33742
+  (0.0ms) SAVEPOINT active_record_1
33743
+ SQL (4.9ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33745
+  (0.0ms) SAVEPOINT active_record_1
33746
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33747
+  (0.0ms) SAVEPOINT active_record_1
33748
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33749
+  (0.0ms) SAVEPOINT active_record_1
33750
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33751
+  (0.0ms) SAVEPOINT active_record_1
33752
+ SQL (0.8ms) INSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["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
+  (0.2ms) UPDATE "addresses" SET "user_id" = 1, "updated_at" = '2011-12-16 22:28:30.275169' WHERE "addresses"."id" = 1
33754
+ SQL (0.5ms) INSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["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
+ SQL (0.4ms) 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
+ SQL (0.5ms) 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]]
33757
+ SQL (0.3ms) 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
+ SQL (0.3ms) 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]]
33759
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33760
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
33761
+ Address Load (0.1ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
33762
+ Picture Load (0.1ms) SELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1
33763
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33764
+  (0.1ms) SELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1
33765
+  (0.1ms) SAVEPOINT active_record_1
33766
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33767
+  (0.0ms) SAVEPOINT active_record_1
33768
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33769
+  (0.0ms) SAVEPOINT active_record_1
33770
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33771
+  (0.0ms) SAVEPOINT active_record_1
33772
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33773
+  (0.0ms) SAVEPOINT active_record_1
33774
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33775
+  (0.0ms) SAVEPOINT active_record_1
33776
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33777
+  (0.0ms) SAVEPOINT active_record_1
33778
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33779
+  (0.0ms) SAVEPOINT active_record_1
33780
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33781
+  (0.1ms) SAVEPOINT active_record_1
33782
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33783
+  (0.0ms) SAVEPOINT active_record_1
33784
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33785
+  (0.1ms) SAVEPOINT active_record_1
33786
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33787
+  (0.0ms) SAVEPOINT active_record_1
33788
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33789
+  (0.0ms) SAVEPOINT active_record_1
33790
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33791
+  (0.0ms) SAVEPOINT active_record_1
33792
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33793
+  (0.0ms) SAVEPOINT active_record_1
33794
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33795
+  (0.0ms) SAVEPOINT active_record_1
33796
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33797
+  (0.1ms) SAVEPOINT active_record_1
33798
+ SQL (0.6ms) INSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["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
+ SQL (0.4ms) 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
+ SQL (0.4ms) INSERT INTO "pictures" ("created_at", "path", "updated_at", "user_id") VALUES (?, ?, ?, ?) [["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
+ SQL (0.3ms) 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
+ SQL (0.3ms) 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]]
33803
+ SQL (0.3ms) 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
+ SQL (0.2ms) 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]]
33805
+  (0.1ms) RELEASE SAVEPOINT active_record_1
33806
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
33807
+ Address Load (0.1ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."user_id" = 1 LIMIT 1
33808
+ Picture Load (0.1ms) SELECT "pictures".* FROM "pictures" WHERE "pictures"."user_id" = 1 LIMIT 1
33809
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33810
+  (0.1ms) SELECT COUNT(*) FROM "nicknames" WHERE "nicknames"."user_id" = 1
33811
+  (0.1ms) SELECT COUNT(*) FROM "projects" WHERE "projects"."user_id" = 1
33812
+  (0.0ms) SAVEPOINT active_record_1
33813
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33814
+  (0.0ms) SAVEPOINT active_record_1
33815
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33816
+  (0.0ms) SAVEPOINT active_record_1
33817
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33818
+  (0.0ms) SAVEPOINT active_record_1
33819
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33820
+  (0.1ms) SAVEPOINT active_record_1
33821
+  (0.2ms) RELEASE SAVEPOINT active_record_1
33822
+  (0.0ms) SAVEPOINT active_record_1
33823
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33824
+  (0.1ms) SAVEPOINT active_record_1
33825
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33826
+  (0.0ms) SAVEPOINT active_record_1
33827
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33828
+  (0.0ms) SAVEPOINT active_record_1
33829
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33830
+  (0.0ms) SAVEPOINT active_record_1
33831
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33832
+  (0.0ms) SAVEPOINT active_record_1
33833
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33834
+  (0.0ms) SAVEPOINT active_record_1
33835
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33836
+  (0.0ms) SAVEPOINT active_record_1
33837
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33838
+  (0.0ms) SAVEPOINT active_record_1
33839
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33840
+  (0.0ms) SAVEPOINT active_record_1
33841
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33842
+  (0.0ms) SAVEPOINT active_record_1
33843
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33844
+  (0.0ms) SAVEPOINT active_record_1
33845
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33846
+  (0.0ms) SAVEPOINT active_record_1
33847
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33848
+  (0.0ms) SAVEPOINT active_record_1
33849
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33850
+  (0.0ms) SAVEPOINT active_record_1
33851
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33852
+  (0.0ms) SAVEPOINT active_record_1
33853
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33854
+  (0.0ms) SAVEPOINT active_record_1
33855
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33856
+  (0.0ms) SAVEPOINT active_record_1
33857
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33858
+  (0.0ms) SAVEPOINT active_record_1
33859
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33860
+  (0.0ms) SAVEPOINT active_record_1
33861
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33862
+  (0.0ms) SAVEPOINT active_record_1
33863
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33864
+  (0.1ms) SAVEPOINT active_record_1
33865
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33866
+  (0.0ms) SAVEPOINT active_record_1
33867
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33868
+  (0.0ms) SAVEPOINT active_record_1
33869
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33870
+  (0.0ms) SAVEPOINT active_record_1
33871
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33872
+  (0.0ms) SAVEPOINT active_record_1
33873
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33874
+  (0.0ms) SAVEPOINT active_record_1
33875
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33876
+  (0.1ms) SAVEPOINT active_record_1
33877
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33878
+  (0.0ms) SAVEPOINT active_record_1
33879
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33880
+  (0.0ms) SAVEPOINT active_record_1
33881
+  (0.0ms) RELEASE SAVEPOINT active_record_1
33882
+  (0.0ms) SAVEPOINT active_record_1
33883
+  (0.0ms) 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
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 00:00:00.000000000 -05:00
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: &2157980680 !ruby/object:Gem::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: *2157980680
24
+ version_requirements: *70179119875860
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: sqlite3
28
- requirement: &2157980260 !ruby/object:Gem::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: *2157980260
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.6.2
131
+ rubygems_version: 1.8.10
132
132
  signing_key:
133
133
  specification_version: 3
134
134
  summary: Automatically initialize associations in Rails models