has_many_polymorphs 2.10 → 2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +191 -56
- data/TODO +1 -0
- data/examples/hmph.rb +69 -0
- data/generators/commenting/commenting_generator.rb +94 -0
- data/generators/commenting/templates/comment.rb +33 -0
- data/generators/commenting/templates/comment_test.rb +12 -0
- data/generators/commenting/templates/commenting.rb +13 -0
- data/generators/commenting/templates/commenting_extensions.rb +30 -0
- data/generators/commenting/templates/commenting_test.rb +30 -0
- data/generators/commenting/templates/commentings.yml +23 -0
- data/generators/commenting/templates/comments.yml +13 -0
- data/generators/commenting/templates/migration.rb +28 -0
- data/generators/tagging/templates/tagging_extensions.rb +4 -8
- data/has_many_polymorphs.gemspec +19 -12
- data/lib/has_many_polymorphs.rb +3 -4
- data/lib/has_many_polymorphs/autoload.rb +4 -4
- data/lib/has_many_polymorphs/class_methods.rb +8 -8
- data/lib/has_many_polymorphs/debugging_tools.rb +2 -0
- data/lib/has_many_polymorphs/dependencies.rb +9 -4
- data/lib/has_many_polymorphs/support_methods.rb +3 -1
- data/test/fixtures/{aquatic/fish.yml → fish.yml} +0 -0
- data/test/fixtures/{aquatic/little_whale_pupils.yml → little_whale_pupils.yml} +0 -0
- data/test/fixtures/{aquatic/whales.yml → whales.yml} +0 -0
- data/test/integration/app/README +182 -0
- data/test/integration/app/Rakefile +19 -0
- data/test/integration/app/app/controllers/addresses_controller.rb +85 -0
- data/test/integration/app/app/controllers/application.rb +7 -0
- data/test/integration/app/app/controllers/sellers_controller.rb +85 -0
- data/test/integration/app/app/controllers/states_controller.rb +85 -0
- data/test/integration/app/app/controllers/users_controller.rb +85 -0
- data/test/integration/app/app/helpers/addresses_helper.rb +2 -0
- data/test/integration/app/app/helpers/application_helper.rb +3 -0
- data/test/integration/app/app/helpers/sellers_helper.rb +28 -0
- data/test/integration/app/app/helpers/states_helper.rb +2 -0
- data/test/integration/app/app/helpers/users_helper.rb +2 -0
- data/test/integration/app/app/models/address.rb +4 -0
- data/test/integration/app/app/models/citation.rb +3 -0
- data/test/integration/app/app/models/citations_item.rb +4 -0
- data/test/integration/app/app/models/seller.rb +4 -0
- data/test/integration/app/app/models/state.rb +3 -0
- data/test/integration/app/app/models/user.rb +4 -0
- data/test/integration/app/app/views/addresses/edit.html.erb +12 -0
- data/test/integration/app/app/views/addresses/index.html.erb +18 -0
- data/test/integration/app/app/views/addresses/new.html.erb +11 -0
- data/test/integration/app/app/views/addresses/show.html.erb +3 -0
- data/test/integration/app/app/views/layouts/addresses.html.erb +17 -0
- data/test/integration/app/app/views/layouts/sellers.html.erb +17 -0
- data/test/integration/app/app/views/layouts/states.html.erb +17 -0
- data/test/integration/app/app/views/layouts/users.html.erb +17 -0
- data/test/integration/app/app/views/sellers/edit.html.erb +12 -0
- data/test/integration/app/app/views/sellers/index.html.erb +20 -0
- data/test/integration/app/app/views/sellers/new.html.erb +11 -0
- data/test/integration/app/app/views/sellers/show.html.erb +3 -0
- data/test/integration/app/app/views/states/edit.html.erb +12 -0
- data/test/integration/app/app/views/states/index.html.erb +19 -0
- data/test/integration/app/app/views/states/new.html.erb +11 -0
- data/test/integration/app/app/views/states/show.html.erb +3 -0
- data/test/integration/app/app/views/users/edit.html.erb +12 -0
- data/test/integration/app/app/views/users/index.html.erb +22 -0
- data/test/integration/app/app/views/users/new.html.erb +11 -0
- data/test/integration/app/app/views/users/show.html.erb +3 -0
- data/test/integration/app/config/boot.rb +45 -0
- data/test/integration/app/config/database.yml +21 -0
- data/test/integration/app/config/environment.rb +13 -0
- data/test/integration/app/config/environments/development.rb +7 -0
- data/test/integration/app/config/environments/production.rb +18 -0
- data/test/integration/app/config/environments/test.rb +19 -0
- data/test/integration/app/config/locomotive.yml +6 -0
- data/test/integration/app/config/routes.rb +33 -0
- data/test/integration/app/config/ultrasphinx/default.base +56 -0
- data/test/integration/app/config/ultrasphinx/development.conf.canonical +155 -0
- data/test/integration/app/db/migrate/001_create_users.rb +16 -0
- data/test/integration/app/db/migrate/002_create_sellers.rb +14 -0
- data/test/integration/app/db/migrate/003_create_addresses.rb +19 -0
- data/test/integration/app/db/migrate/004_create_states.rb +12 -0
- data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +9 -0
- data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +9 -0
- data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +11 -0
- data/test/integration/app/db/migrate/008_create_citations.rb +12 -0
- data/test/integration/app/db/migrate/009_create_citations_items.rb +14 -0
- data/test/integration/app/db/schema.rb +144 -0
- data/test/integration/app/doc/README_FOR_APP +2 -0
- data/test/integration/app/generated_models/aquatic_fish.rb +109 -0
- data/test/integration/app/generated_models/aquatic_pupils_whale.rb +13 -0
- data/test/integration/app/generated_models/aquatic_whale.rb +42 -0
- data/test/integration/app/generated_models/beautiful_fight_relationship.rb +25 -0
- data/test/integration/app/generated_models/citation.rb +40 -0
- data/test/integration/app/generated_models/citations_item.rb +12 -0
- data/test/integration/app/generated_models/dog.rb +183 -0
- data/test/integration/app/generated_models/eaters_foodstuff.rb +13 -0
- data/test/integration/app/generated_models/frog.rb +78 -0
- data/test/integration/app/generated_models/kitten.rb +161 -0
- data/test/integration/app/generated_models/parentship.rb +14 -0
- data/test/integration/app/generated_models/person.rb +53 -0
- data/test/integration/app/generated_models/petfood.rb +125 -0
- data/test/integration/app/generated_models/polymorph_test_some_model.rb +25 -0
- data/test/integration/app/generated_models/seller.rb +30 -0
- data/test/integration/app/generated_models/tabby.rb +26 -0
- data/test/integration/app/generated_models/user.rb +34 -0
- data/test/integration/app/generated_models/wild_boar.rb +87 -0
- data/test/integration/app/generators/commenting_generator_test.rb +83 -0
- data/test/integration/app/public/404.html +30 -0
- data/test/integration/app/public/500.html +30 -0
- data/test/integration/app/public/dispatch.cgi +10 -0
- data/test/integration/app/public/dispatch.fcgi +24 -0
- data/test/integration/app/public/dispatch.rb +10 -0
- data/test/integration/app/public/favicon.ico +0 -0
- data/test/integration/app/public/images/rails.png +0 -0
- data/test/integration/app/public/index.html +277 -0
- data/test/integration/app/public/javascripts/application.js +2 -0
- data/test/integration/app/public/javascripts/controls.js +833 -0
- data/test/integration/app/public/javascripts/dragdrop.js +942 -0
- data/test/integration/app/public/javascripts/effects.js +1088 -0
- data/test/integration/app/public/javascripts/prototype.js +2515 -0
- data/test/integration/app/public/robots.txt +1 -0
- data/test/integration/app/public/stylesheets/scaffold.css +74 -0
- data/test/integration/app/script/about +3 -0
- data/test/integration/app/script/breakpointer +3 -0
- data/test/integration/app/script/console +3 -0
- data/test/integration/app/script/destroy +3 -0
- data/test/integration/app/script/generate +3 -0
- data/test/integration/app/script/performance/benchmarker +3 -0
- data/test/integration/app/script/performance/profiler +3 -0
- data/test/integration/app/script/plugin +3 -0
- data/test/integration/app/script/process/inspector +3 -0
- data/test/integration/app/script/process/reaper +3 -0
- data/test/integration/app/script/process/spawner +3 -0
- data/test/integration/app/script/runner +3 -0
- data/test/integration/app/script/server +3 -0
- data/test/integration/app/test/fixtures/addresses.yml +13 -0
- data/test/integration/app/test/fixtures/citations.yml +9 -0
- data/test/integration/app/test/fixtures/citations_items.yml +9 -0
- data/test/integration/app/test/fixtures/sellers.yml +10 -0
- data/test/integration/app/test/fixtures/states.yml +216 -0
- data/test/integration/app/test/fixtures/users.yml +11 -0
- data/test/integration/app/test/functional/addresses_controller_test.rb +57 -0
- data/test/integration/app/test/functional/sellers_controller_test.rb +57 -0
- data/test/integration/app/test/functional/states_controller_test.rb +57 -0
- data/test/integration/app/test/functional/users_controller_test.rb +57 -0
- data/test/integration/app/test/test_helper.rb +28 -0
- data/test/integration/app/test/unit/address_test.rb +10 -0
- data/test/integration/app/test/unit/citation_test.rb +10 -0
- data/test/integration/app/test/unit/citations_item_test.rb +10 -0
- data/test/integration/app/test/unit/seller_test.rb +10 -0
- data/test/integration/app/test/unit/state_test.rb +10 -0
- data/test/integration/app/test/unit/user_test.rb +10 -0
- data/test/models/aquatic/fish.rb +2 -1
- data/test/models/aquatic/whale.rb +2 -0
- data/test/setup.rb +10 -0
- data/test/test_all.rb +16 -0
- data/test/test_helper.rb +16 -12
- data/test/unit/polymorph_test.rb +35 -34
- metadata +239 -98
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
|
|
2
|
+
v2.11. Rails 1.2.6 tagging generator compatibility; change test suite to use included integration app; include commenting generator (not well tested) [Josh Stephenson].
|
|
3
|
+
|
|
2
4
|
v2.10. Add :parent_conditions option; bugfix for nullified conditions; bugfix for self-referential tagging generator; allow setting of has_many_polymorphs_options hash in Configuration's after_initialize if you need to adjust the autoload behavior; clear error message on missing or improperly namespaced models; fix .build on double-sided relationships; add :namespace key for easier set up of Camping apps or other unusual class structures.
|
|
3
5
|
|
|
4
6
|
v2.9. Gem version renumbering; my apologies if this messes anyone up.
|
data/Manifest
CHANGED
|
@@ -1,57 +1,192 @@
|
|
|
1
|
-
TODO
|
|
2
|
-
test/unit/polymorph_test.rb
|
|
3
|
-
test/test_helper.rb
|
|
4
|
-
test/schema.rb
|
|
5
|
-
test/modules/other_extension_module.rb
|
|
6
|
-
test/modules/extension_module.rb
|
|
7
|
-
test/models/wild_boar.rb
|
|
8
|
-
test/models/tabby.rb
|
|
9
|
-
test/models/petfood.rb
|
|
10
|
-
test/models/person.rb
|
|
11
|
-
test/models/parentship.rb
|
|
12
|
-
test/models/kitten.rb
|
|
13
|
-
test/models/frog.rb
|
|
14
|
-
test/models/eaters_foodstuff.rb
|
|
15
|
-
test/models/dog.rb
|
|
16
|
-
test/models/cat.rb
|
|
17
|
-
test/models/canine.rb
|
|
18
|
-
test/models/beautiful_fight_relationship.rb
|
|
19
|
-
test/models/aquatic/whale.rb
|
|
20
|
-
test/models/aquatic/pupils_whale.rb
|
|
21
|
-
test/models/aquatic/fish.rb
|
|
22
|
-
test/fixtures/wild_boars.yml
|
|
23
|
-
test/fixtures/petfoods.yml
|
|
24
|
-
test/fixtures/people.yml
|
|
25
|
-
test/fixtures/keep_your_enemies_close.yml
|
|
26
|
-
test/fixtures/frogs.yml
|
|
27
|
-
test/fixtures/eaters_foodstuffs.yml
|
|
28
|
-
test/fixtures/cats.yml
|
|
29
|
-
test/fixtures/bow_wows.yml
|
|
30
|
-
test/fixtures/aquatic/whales.yml
|
|
31
|
-
test/fixtures/aquatic/little_whale_pupils.yml
|
|
32
|
-
test/fixtures/aquatic/fish.yml
|
|
33
|
-
README
|
|
34
|
-
Manifest
|
|
35
|
-
LICENSE
|
|
36
|
-
lib/has_many_polymorphs.rb
|
|
37
|
-
lib/has_many_polymorphs/support_methods.rb
|
|
38
|
-
lib/has_many_polymorphs/reflection.rb
|
|
39
|
-
lib/has_many_polymorphs/rake_task_redefine_task.rb
|
|
40
|
-
lib/has_many_polymorphs/dependencies.rb
|
|
41
|
-
lib/has_many_polymorphs/debugging_tools.rb
|
|
42
|
-
lib/has_many_polymorphs/configuration.rb
|
|
43
|
-
lib/has_many_polymorphs/class_methods.rb
|
|
44
|
-
lib/has_many_polymorphs/base.rb
|
|
45
|
-
lib/has_many_polymorphs/autoload.rb
|
|
46
|
-
lib/has_many_polymorphs/association.rb
|
|
47
|
-
init.rb
|
|
48
|
-
generators/tagging/templates/tags.yml
|
|
49
|
-
generators/tagging/templates/taggings.yml
|
|
50
|
-
generators/tagging/templates/tagging_test.rb
|
|
51
|
-
generators/tagging/templates/tagging_extensions.rb
|
|
52
|
-
generators/tagging/templates/tagging.rb
|
|
53
|
-
generators/tagging/templates/tag_test.rb
|
|
54
|
-
generators/tagging/templates/tag.rb
|
|
55
|
-
generators/tagging/templates/migration.rb
|
|
56
|
-
generators/tagging/tagging_generator.rb
|
|
57
1
|
CHANGELOG
|
|
2
|
+
examples/hmph.rb
|
|
3
|
+
generators/commenting/commenting_generator.rb
|
|
4
|
+
generators/commenting/templates/comment.rb
|
|
5
|
+
generators/commenting/templates/comment_test.rb
|
|
6
|
+
generators/commenting/templates/commenting.rb
|
|
7
|
+
generators/commenting/templates/commenting_extensions.rb
|
|
8
|
+
generators/commenting/templates/commenting_test.rb
|
|
9
|
+
generators/commenting/templates/commentings.yml
|
|
10
|
+
generators/commenting/templates/comments.yml
|
|
11
|
+
generators/commenting/templates/migration.rb
|
|
12
|
+
generators/tagging/tagging_generator.rb
|
|
13
|
+
generators/tagging/templates/migration.rb
|
|
14
|
+
generators/tagging/templates/tag.rb
|
|
15
|
+
generators/tagging/templates/tag_test.rb
|
|
16
|
+
generators/tagging/templates/tagging.rb
|
|
17
|
+
generators/tagging/templates/tagging_extensions.rb
|
|
18
|
+
generators/tagging/templates/tagging_test.rb
|
|
19
|
+
generators/tagging/templates/taggings.yml
|
|
20
|
+
generators/tagging/templates/tags.yml
|
|
21
|
+
init.rb
|
|
22
|
+
lib/has_many_polymorphs/association.rb
|
|
23
|
+
lib/has_many_polymorphs/autoload.rb
|
|
24
|
+
lib/has_many_polymorphs/base.rb
|
|
25
|
+
lib/has_many_polymorphs/class_methods.rb
|
|
26
|
+
lib/has_many_polymorphs/configuration.rb
|
|
27
|
+
lib/has_many_polymorphs/debugging_tools.rb
|
|
28
|
+
lib/has_many_polymorphs/dependencies.rb
|
|
29
|
+
lib/has_many_polymorphs/rake_task_redefine_task.rb
|
|
30
|
+
lib/has_many_polymorphs/reflection.rb
|
|
31
|
+
lib/has_many_polymorphs/support_methods.rb
|
|
32
|
+
lib/has_many_polymorphs.rb
|
|
33
|
+
LICENSE
|
|
34
|
+
Manifest
|
|
35
|
+
README
|
|
36
|
+
test/fixtures/bow_wows.yml
|
|
37
|
+
test/fixtures/cats.yml
|
|
38
|
+
test/fixtures/eaters_foodstuffs.yml
|
|
39
|
+
test/fixtures/fish.yml
|
|
40
|
+
test/fixtures/frogs.yml
|
|
41
|
+
test/fixtures/keep_your_enemies_close.yml
|
|
42
|
+
test/fixtures/little_whale_pupils.yml
|
|
43
|
+
test/fixtures/people.yml
|
|
44
|
+
test/fixtures/petfoods.yml
|
|
45
|
+
test/fixtures/whales.yml
|
|
46
|
+
test/fixtures/wild_boars.yml
|
|
47
|
+
test/integration/app/app/controllers/addresses_controller.rb
|
|
48
|
+
test/integration/app/app/controllers/application.rb
|
|
49
|
+
test/integration/app/app/controllers/sellers_controller.rb
|
|
50
|
+
test/integration/app/app/controllers/states_controller.rb
|
|
51
|
+
test/integration/app/app/controllers/users_controller.rb
|
|
52
|
+
test/integration/app/app/helpers/addresses_helper.rb
|
|
53
|
+
test/integration/app/app/helpers/application_helper.rb
|
|
54
|
+
test/integration/app/app/helpers/sellers_helper.rb
|
|
55
|
+
test/integration/app/app/helpers/states_helper.rb
|
|
56
|
+
test/integration/app/app/helpers/users_helper.rb
|
|
57
|
+
test/integration/app/app/models/address.rb
|
|
58
|
+
test/integration/app/app/models/citation.rb
|
|
59
|
+
test/integration/app/app/models/citations_item.rb
|
|
60
|
+
test/integration/app/app/models/seller.rb
|
|
61
|
+
test/integration/app/app/models/state.rb
|
|
62
|
+
test/integration/app/app/models/user.rb
|
|
63
|
+
test/integration/app/app/views/addresses/edit.html.erb
|
|
64
|
+
test/integration/app/app/views/addresses/index.html.erb
|
|
65
|
+
test/integration/app/app/views/addresses/new.html.erb
|
|
66
|
+
test/integration/app/app/views/addresses/show.html.erb
|
|
67
|
+
test/integration/app/app/views/layouts/addresses.html.erb
|
|
68
|
+
test/integration/app/app/views/layouts/sellers.html.erb
|
|
69
|
+
test/integration/app/app/views/layouts/states.html.erb
|
|
70
|
+
test/integration/app/app/views/layouts/users.html.erb
|
|
71
|
+
test/integration/app/app/views/sellers/edit.html.erb
|
|
72
|
+
test/integration/app/app/views/sellers/index.html.erb
|
|
73
|
+
test/integration/app/app/views/sellers/new.html.erb
|
|
74
|
+
test/integration/app/app/views/sellers/show.html.erb
|
|
75
|
+
test/integration/app/app/views/states/edit.html.erb
|
|
76
|
+
test/integration/app/app/views/states/index.html.erb
|
|
77
|
+
test/integration/app/app/views/states/new.html.erb
|
|
78
|
+
test/integration/app/app/views/states/show.html.erb
|
|
79
|
+
test/integration/app/app/views/users/edit.html.erb
|
|
80
|
+
test/integration/app/app/views/users/index.html.erb
|
|
81
|
+
test/integration/app/app/views/users/new.html.erb
|
|
82
|
+
test/integration/app/app/views/users/show.html.erb
|
|
83
|
+
test/integration/app/config/boot.rb
|
|
84
|
+
test/integration/app/config/database.yml
|
|
85
|
+
test/integration/app/config/environment.rb
|
|
86
|
+
test/integration/app/config/environments/development.rb
|
|
87
|
+
test/integration/app/config/environments/production.rb
|
|
88
|
+
test/integration/app/config/environments/test.rb
|
|
89
|
+
test/integration/app/config/locomotive.yml
|
|
90
|
+
test/integration/app/config/routes.rb
|
|
91
|
+
test/integration/app/config/ultrasphinx/default.base
|
|
92
|
+
test/integration/app/config/ultrasphinx/development.conf.canonical
|
|
93
|
+
test/integration/app/db/migrate/001_create_users.rb
|
|
94
|
+
test/integration/app/db/migrate/002_create_sellers.rb
|
|
95
|
+
test/integration/app/db/migrate/003_create_addresses.rb
|
|
96
|
+
test/integration/app/db/migrate/004_create_states.rb
|
|
97
|
+
test/integration/app/db/migrate/005_add_capitalization_to_seller.rb
|
|
98
|
+
test/integration/app/db/migrate/006_add_deleted_to_user.rb
|
|
99
|
+
test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb
|
|
100
|
+
test/integration/app/db/migrate/008_create_citations.rb
|
|
101
|
+
test/integration/app/db/migrate/009_create_citations_items.rb
|
|
102
|
+
test/integration/app/db/schema.rb
|
|
103
|
+
test/integration/app/doc/README_FOR_APP
|
|
104
|
+
test/integration/app/generated_models/aquatic_fish.rb
|
|
105
|
+
test/integration/app/generated_models/aquatic_pupils_whale.rb
|
|
106
|
+
test/integration/app/generated_models/aquatic_whale.rb
|
|
107
|
+
test/integration/app/generated_models/beautiful_fight_relationship.rb
|
|
108
|
+
test/integration/app/generated_models/citation.rb
|
|
109
|
+
test/integration/app/generated_models/citations_item.rb
|
|
110
|
+
test/integration/app/generated_models/dog.rb
|
|
111
|
+
test/integration/app/generated_models/eaters_foodstuff.rb
|
|
112
|
+
test/integration/app/generated_models/frog.rb
|
|
113
|
+
test/integration/app/generated_models/kitten.rb
|
|
114
|
+
test/integration/app/generated_models/parentship.rb
|
|
115
|
+
test/integration/app/generated_models/person.rb
|
|
116
|
+
test/integration/app/generated_models/petfood.rb
|
|
117
|
+
test/integration/app/generated_models/polymorph_test_some_model.rb
|
|
118
|
+
test/integration/app/generated_models/seller.rb
|
|
119
|
+
test/integration/app/generated_models/tabby.rb
|
|
120
|
+
test/integration/app/generated_models/user.rb
|
|
121
|
+
test/integration/app/generated_models/wild_boar.rb
|
|
122
|
+
test/integration/app/generators/commenting_generator_test.rb
|
|
123
|
+
test/integration/app/public/404.html
|
|
124
|
+
test/integration/app/public/500.html
|
|
125
|
+
test/integration/app/public/dispatch.cgi
|
|
126
|
+
test/integration/app/public/dispatch.fcgi
|
|
127
|
+
test/integration/app/public/dispatch.rb
|
|
128
|
+
test/integration/app/public/favicon.ico
|
|
129
|
+
test/integration/app/public/images/rails.png
|
|
130
|
+
test/integration/app/public/index.html
|
|
131
|
+
test/integration/app/public/javascripts/application.js
|
|
132
|
+
test/integration/app/public/javascripts/controls.js
|
|
133
|
+
test/integration/app/public/javascripts/dragdrop.js
|
|
134
|
+
test/integration/app/public/javascripts/effects.js
|
|
135
|
+
test/integration/app/public/javascripts/prototype.js
|
|
136
|
+
test/integration/app/public/robots.txt
|
|
137
|
+
test/integration/app/public/stylesheets/scaffold.css
|
|
138
|
+
test/integration/app/Rakefile
|
|
139
|
+
test/integration/app/README
|
|
140
|
+
test/integration/app/script/about
|
|
141
|
+
test/integration/app/script/breakpointer
|
|
142
|
+
test/integration/app/script/console
|
|
143
|
+
test/integration/app/script/destroy
|
|
144
|
+
test/integration/app/script/generate
|
|
145
|
+
test/integration/app/script/performance/benchmarker
|
|
146
|
+
test/integration/app/script/performance/profiler
|
|
147
|
+
test/integration/app/script/plugin
|
|
148
|
+
test/integration/app/script/process/inspector
|
|
149
|
+
test/integration/app/script/process/reaper
|
|
150
|
+
test/integration/app/script/process/spawner
|
|
151
|
+
test/integration/app/script/runner
|
|
152
|
+
test/integration/app/script/server
|
|
153
|
+
test/integration/app/test/fixtures/addresses.yml
|
|
154
|
+
test/integration/app/test/fixtures/citations.yml
|
|
155
|
+
test/integration/app/test/fixtures/citations_items.yml
|
|
156
|
+
test/integration/app/test/fixtures/sellers.yml
|
|
157
|
+
test/integration/app/test/fixtures/states.yml
|
|
158
|
+
test/integration/app/test/fixtures/users.yml
|
|
159
|
+
test/integration/app/test/functional/addresses_controller_test.rb
|
|
160
|
+
test/integration/app/test/functional/sellers_controller_test.rb
|
|
161
|
+
test/integration/app/test/functional/states_controller_test.rb
|
|
162
|
+
test/integration/app/test/functional/users_controller_test.rb
|
|
163
|
+
test/integration/app/test/test_helper.rb
|
|
164
|
+
test/integration/app/test/unit/address_test.rb
|
|
165
|
+
test/integration/app/test/unit/citation_test.rb
|
|
166
|
+
test/integration/app/test/unit/citations_item_test.rb
|
|
167
|
+
test/integration/app/test/unit/seller_test.rb
|
|
168
|
+
test/integration/app/test/unit/state_test.rb
|
|
169
|
+
test/integration/app/test/unit/user_test.rb
|
|
170
|
+
test/models/aquatic/fish.rb
|
|
171
|
+
test/models/aquatic/pupils_whale.rb
|
|
172
|
+
test/models/aquatic/whale.rb
|
|
173
|
+
test/models/beautiful_fight_relationship.rb
|
|
174
|
+
test/models/canine.rb
|
|
175
|
+
test/models/cat.rb
|
|
176
|
+
test/models/dog.rb
|
|
177
|
+
test/models/eaters_foodstuff.rb
|
|
178
|
+
test/models/frog.rb
|
|
179
|
+
test/models/kitten.rb
|
|
180
|
+
test/models/parentship.rb
|
|
181
|
+
test/models/person.rb
|
|
182
|
+
test/models/petfood.rb
|
|
183
|
+
test/models/tabby.rb
|
|
184
|
+
test/models/wild_boar.rb
|
|
185
|
+
test/modules/extension_module.rb
|
|
186
|
+
test/modules/other_extension_module.rb
|
|
187
|
+
test/schema.rb
|
|
188
|
+
test/setup.rb
|
|
189
|
+
test/test_all.rb
|
|
190
|
+
test/test_helper.rb
|
|
191
|
+
test/unit/polymorph_test.rb
|
|
192
|
+
TODO
|
data/TODO
CHANGED
data/examples/hmph.rb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require 'camping'
|
|
2
|
+
require 'has_many_polymorphs'
|
|
3
|
+
|
|
4
|
+
Camping.goes :Hmph
|
|
5
|
+
|
|
6
|
+
module Hmph::Models
|
|
7
|
+
class GuestsKennel < Base
|
|
8
|
+
belongs_to :kennel
|
|
9
|
+
belongs_to :guest, :polymorphic => true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class Dog < Base
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Cat < Base
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Bird < Base
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Kennel < Base
|
|
22
|
+
has_many_polymorphs :guests,
|
|
23
|
+
:from => [:dogs, :cats, :birds],
|
|
24
|
+
:through => :guests_kennels,
|
|
25
|
+
:namespace => :"hmph/models/"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class InitialSchema < V 1.0
|
|
29
|
+
def self.up
|
|
30
|
+
create_table :hmph_kennels do |t|
|
|
31
|
+
t.column :created_at, :datetime
|
|
32
|
+
t.column :modified_at, :datetime
|
|
33
|
+
t.column :name, :string, :default => 'Anonymous Kennel'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
create_table :hmph_guests_kennels do |t|
|
|
37
|
+
t.column :guest_id, :integer
|
|
38
|
+
t.column :guest_type, :string
|
|
39
|
+
t.column :kennel_id, :integer
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
create_table :hmph_dogs do |t|
|
|
43
|
+
t.column :name, :string, :default => 'Fido'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
create_table :hmph_cats do |t|
|
|
47
|
+
t.column :name, :string, :default => 'Morris'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
create_table :hmph_birds do |t|
|
|
51
|
+
t.column :name, :string, :default => 'Polly'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.down
|
|
56
|
+
drop_table :hmph_kennels
|
|
57
|
+
drop_table :hmph_guests_kennels
|
|
58
|
+
drop_table :hmph_dogs
|
|
59
|
+
drop_table :hmph_cats
|
|
60
|
+
drop_table :hmph_birds
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
module Hmph::Controllers
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module Hmph::Views
|
|
69
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
class CommentingGenerator < Rails::Generator::NamedBase
|
|
3
|
+
default_options :skip_migration => false
|
|
4
|
+
default_options :self_referential => false
|
|
5
|
+
attr_reader :parent_association_name
|
|
6
|
+
attr_reader :commentable_models
|
|
7
|
+
|
|
8
|
+
def initialize(runtime_args, runtime_options = {})
|
|
9
|
+
@parent_association_name = (runtime_args.include?("--self-referential") ? "commenter" : "comment")
|
|
10
|
+
@commentable_models = runtime_args.reject{|opt| opt =~ /^--/}.map do |commentable|
|
|
11
|
+
":" + commentable.underscore.pluralize
|
|
12
|
+
end
|
|
13
|
+
@commentable_models += [":comments"] if runtime_args.include?("--self-referential")
|
|
14
|
+
@commentable_models.uniq!
|
|
15
|
+
|
|
16
|
+
verify @commentable_models
|
|
17
|
+
hacks
|
|
18
|
+
runtime_args.unshift("placeholder")
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def verify models
|
|
23
|
+
puts "** Warning: only one commentable model specified; tests may not run properly." if models.size < 2
|
|
24
|
+
models.each do |model|
|
|
25
|
+
model = model[1..-1].classify
|
|
26
|
+
next if model == "Comment" # don't load ourselves when --self-referential is used
|
|
27
|
+
self.class.const_get(model) rescue puts "** Error: model #{model[1..-1].classify} could not be loaded." or exit
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def hacks
|
|
32
|
+
# add the extension require in environment.rb
|
|
33
|
+
phrase = "require 'commenting_extensions'"
|
|
34
|
+
filename = "#{RAILS_ROOT}/config/environment.rb"
|
|
35
|
+
unless (open(filename) do |file|
|
|
36
|
+
file.grep(/#{Regexp.escape phrase}/).any?
|
|
37
|
+
end)
|
|
38
|
+
open(filename, 'a+') do |file|
|
|
39
|
+
file.puts "\n" + phrase + "\n"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def manifest
|
|
45
|
+
record do |m|
|
|
46
|
+
m.class_collisions class_path, class_name, "#{class_name}Test"
|
|
47
|
+
|
|
48
|
+
m.directory File.join('app/models', class_path)
|
|
49
|
+
m.directory File.join('test/unit', class_path)
|
|
50
|
+
m.directory File.join('test/fixtures', class_path)
|
|
51
|
+
m.directory File.join('test/fixtures', class_path)
|
|
52
|
+
m.directory File.join('lib')
|
|
53
|
+
|
|
54
|
+
m.template 'comment.rb', File.join('app/models', class_path, "comment.rb")
|
|
55
|
+
m.template 'comment_test.rb', File.join('test/unit', class_path, "comment_test.rb")
|
|
56
|
+
m.template 'comments.yml', File.join('test/fixtures', class_path, "comments.yml")
|
|
57
|
+
|
|
58
|
+
m.template 'commenting.rb', File.join('app/models', class_path, "commenting.rb")
|
|
59
|
+
m.template 'commenting_test.rb', File.join('test/unit', class_path, "commenting_test.rb")
|
|
60
|
+
m.template 'commentings.yml', File.join('test/fixtures', class_path, "commentings.yml")
|
|
61
|
+
|
|
62
|
+
m.template 'commenting_extensions.rb', File.join('lib', 'commenting_extensions.rb')
|
|
63
|
+
|
|
64
|
+
unless options[:skip_migration]
|
|
65
|
+
m.migration_template 'migration.rb', 'db/migrate',
|
|
66
|
+
:migration_file_name => "create_comments_and_commentings"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
protected
|
|
73
|
+
def banner
|
|
74
|
+
"Usage: #{$0} generate commenting [CommentableModelA CommentableModelB ...]"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def add_options!(opt)
|
|
78
|
+
opt.separator ''
|
|
79
|
+
opt.separator 'Options:'
|
|
80
|
+
opt.on("--skip-migration",
|
|
81
|
+
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
|
82
|
+
opt.on("--self-referential",
|
|
83
|
+
"Allow comments to comment themselves.") { |v| options[:self_referential] = v }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Useful for generating tests/fixtures
|
|
87
|
+
def model_one
|
|
88
|
+
commentable_models[0][1..-1].classify
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def model_two
|
|
92
|
+
commentable_models[1][1..-1].classify rescue model_one
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
# The Comment model. This model is automatically generated and added to your app if you run the commenting generator.
|
|
3
|
+
|
|
4
|
+
class Comment < ActiveRecord::Base
|
|
5
|
+
|
|
6
|
+
# If database speed becomes an issue, you could remove these validations and rescue the ActiveRecord database constraint errors instead.
|
|
7
|
+
validates_presence_of :name, :email, :body
|
|
8
|
+
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
|
9
|
+
|
|
10
|
+
after_validation :prepend_url
|
|
11
|
+
|
|
12
|
+
# Set up the polymorphic relationship.
|
|
13
|
+
has_many_polymorphs :commentables,
|
|
14
|
+
:from => [<%= commentable_models.join(", ") %>],
|
|
15
|
+
:through => :commentings,
|
|
16
|
+
:dependent => :destroy,
|
|
17
|
+
<% if options[:self_referential] -%> :as => :<%= parent_association_name -%>,
|
|
18
|
+
<% end -%>
|
|
19
|
+
:parent_extend => proc {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Tag::Error class. Raised by ActiveRecord::Base::TaggingExtensions if something goes wrong.
|
|
23
|
+
class Error < StandardError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
protected
|
|
27
|
+
def prepend_url
|
|
28
|
+
return if self[:url].blank?
|
|
29
|
+
if self[:url] !~ /^http(s):\/\//i
|
|
30
|
+
self.url = 'http://' + self[:url]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|