has_many_polymorphs 2.11 → 2.12
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +3 -1
- data/Manifest +43 -61
- data/README +30 -0
- data/TODO +0 -3
- data/generators/tagging/tagging_generator.rb +2 -0
- data/generators/tagging/templates/tag_test.rb +7 -2
- data/generators/tagging/templates/tagging.rb +2 -2
- data/generators/tagging/templates/tagging_extensions.rb +49 -2
- data/generators/tagging/templates/tagging_test.rb +32 -9
- data/generators/tagging/templates/tags.yml +2 -2
- data/has_many_polymorphs.gemspec +20 -13
- data/lib/has_many_polymorphs.rb +0 -1
- data/lib/has_many_polymorphs/autoload.rb +45 -37
- data/lib/has_many_polymorphs/class_methods.rb +2 -15
- data/lib/has_many_polymorphs/configuration.rb +2 -2
- data/lib/has_many_polymorphs/rake_task_redefine_task.rb +9 -1
- data/test/generator/tagging_generator_test.rb +42 -0
- data/test/integration/app/app/controllers/bones_controller.rb +5 -0
- data/test/integration/app/app/helpers/bones_helper.rb +2 -0
- data/test/integration/app/app/models/bone.rb +2 -0
- data/test/integration/app/app/models/double_sti_parent.rb +2 -0
- data/test/integration/app/app/models/double_sti_parent_relationship.rb +2 -0
- data/test/integration/app/app/models/organic_substance.rb +2 -0
- data/test/integration/app/app/models/single_sti_parent.rb +4 -0
- data/test/integration/app/app/models/single_sti_parent_relationship.rb +4 -0
- data/test/integration/app/app/models/stick.rb +2 -0
- data/test/integration/app/app/models/stone.rb +2 -0
- data/test/integration/app/app/views/bones/index.rhtml +5 -0
- data/test/integration/app/config/boot.rb +97 -32
- data/test/integration/app/config/database.yml +8 -12
- data/test/integration/app/config/environment.rb +9 -3
- data/test/integration/app/config/environment.rb.canonical +19 -0
- data/test/integration/app/config/environments/development.rb +6 -5
- data/test/integration/app/db/migrate/001_create_sticks.rb +11 -0
- data/test/integration/app/db/migrate/002_create_stones.rb +11 -0
- data/test/integration/app/db/migrate/003_create_organic_substances.rb +11 -0
- data/test/integration/app/db/migrate/004_create_bones.rb +8 -0
- data/test/integration/app/db/migrate/005_create_single_sti_parents.rb +11 -0
- data/test/integration/app/db/migrate/006_create_double_sti_parents.rb +11 -0
- data/test/integration/app/db/migrate/007_create_single_sti_parent_relationships.rb +13 -0
- data/test/integration/app/db/migrate/008_create_double_sti_parent_relationships.rb +14 -0
- data/test/integration/app/db/migrate/009_create_library_model.rb +11 -0
- data/test/integration/app/db/schema.rb +21 -121
- data/test/integration/app/hmp_development +0 -0
- data/test/integration/app/lib/library_model.rb +2 -0
- data/test/integration/app/test/fixtures/double_sti_parent_relationships.yml +7 -0
- data/test/integration/app/test/fixtures/double_sti_parents.yml +7 -0
- data/test/integration/app/test/fixtures/organic_substances.yml +5 -0
- data/test/integration/app/test/fixtures/single_sti_parent_relationships.yml +7 -0
- data/test/integration/app/test/fixtures/single_sti_parents.yml +7 -0
- data/test/integration/app/test/fixtures/sticks.yml +7 -0
- data/test/integration/app/test/fixtures/stones.yml +7 -0
- data/test/integration/app/test/{unit/user_test.rb → functional/bones_controller_test.rb} +1 -3
- data/test/integration/app/test/test_helper.rb +1 -21
- data/test/integration/app/test/unit/{state_test.rb → bone_test.rb} +1 -3
- data/test/integration/app/test/unit/{seller_test.rb → double_sti_parent_relationship_test.rb} +1 -3
- data/test/integration/app/test/unit/{address_test.rb → double_sti_parent_test.rb} +1 -3
- data/test/integration/app/test/unit/organic_substance_test.rb +8 -0
- data/test/integration/app/test/unit/single_sti_parent_relationship_test.rb +8 -0
- data/test/integration/app/test/unit/single_sti_parent_test.rb +8 -0
- data/test/integration/app/test/unit/stick_test.rb +8 -0
- data/test/integration/app/test/unit/stone_test.rb +8 -0
- data/test/integration/server_test.rb +43 -0
- data/test/patches/symlinked_plugins_1.2.6.diff +46 -0
- data/test/setup.rb +6 -2
- data/test/test_helper.rb +32 -16
- data/test/unit/{polymorph_test.rb → has_many_polymorphs_test.rb} +16 -16
- metadata +49 -65
- metadata.gz.sig +0 -0
- data/generators/commenting/commenting_generator.rb +0 -94
- data/generators/commenting/templates/comment.rb +0 -33
- data/generators/commenting/templates/comment_test.rb +0 -12
- data/generators/commenting/templates/commenting.rb +0 -13
- data/generators/commenting/templates/commenting_extensions.rb +0 -30
- data/generators/commenting/templates/commenting_test.rb +0 -30
- data/generators/commenting/templates/commentings.yml +0 -23
- data/generators/commenting/templates/comments.yml +0 -13
- data/generators/commenting/templates/migration.rb +0 -28
- data/lib/has_many_polymorphs/dependencies.rb +0 -41
- data/test/integration/app/app/controllers/addresses_controller.rb +0 -85
- data/test/integration/app/app/controllers/sellers_controller.rb +0 -85
- data/test/integration/app/app/controllers/states_controller.rb +0 -85
- data/test/integration/app/app/controllers/users_controller.rb +0 -85
- data/test/integration/app/app/models/address.rb +0 -4
- data/test/integration/app/app/models/citation.rb +0 -3
- data/test/integration/app/app/models/citations_item.rb +0 -4
- data/test/integration/app/app/models/seller.rb +0 -4
- data/test/integration/app/app/models/state.rb +0 -3
- data/test/integration/app/app/models/user.rb +0 -4
- data/test/integration/app/db/migrate/001_create_users.rb +0 -16
- data/test/integration/app/db/migrate/002_create_sellers.rb +0 -14
- data/test/integration/app/db/migrate/003_create_addresses.rb +0 -19
- data/test/integration/app/db/migrate/004_create_states.rb +0 -12
- data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +0 -9
- data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +0 -9
- data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +0 -11
- data/test/integration/app/db/migrate/008_create_citations.rb +0 -12
- data/test/integration/app/db/migrate/009_create_citations_items.rb +0 -14
- data/test/integration/app/generated_models/aquatic_fish.rb +0 -109
- data/test/integration/app/generated_models/aquatic_pupils_whale.rb +0 -13
- data/test/integration/app/generated_models/aquatic_whale.rb +0 -42
- data/test/integration/app/generated_models/beautiful_fight_relationship.rb +0 -25
- data/test/integration/app/generated_models/citation.rb +0 -40
- data/test/integration/app/generated_models/citations_item.rb +0 -12
- data/test/integration/app/generated_models/dog.rb +0 -183
- data/test/integration/app/generated_models/eaters_foodstuff.rb +0 -13
- data/test/integration/app/generated_models/frog.rb +0 -78
- data/test/integration/app/generated_models/kitten.rb +0 -161
- data/test/integration/app/generated_models/parentship.rb +0 -14
- data/test/integration/app/generated_models/person.rb +0 -53
- data/test/integration/app/generated_models/petfood.rb +0 -125
- data/test/integration/app/generated_models/polymorph_test_some_model.rb +0 -25
- data/test/integration/app/generated_models/seller.rb +0 -30
- data/test/integration/app/generated_models/tabby.rb +0 -26
- data/test/integration/app/generated_models/user.rb +0 -34
- data/test/integration/app/generated_models/wild_boar.rb +0 -87
- data/test/integration/app/test/fixtures/addresses.yml +0 -13
- data/test/integration/app/test/fixtures/citations.yml +0 -9
- data/test/integration/app/test/fixtures/citations_items.yml +0 -9
- data/test/integration/app/test/fixtures/sellers.yml +0 -10
- data/test/integration/app/test/fixtures/states.yml +0 -216
- data/test/integration/app/test/fixtures/users.yml +0 -11
- data/test/integration/app/test/unit/citation_test.rb +0 -10
- data/test/integration/app/test/unit/citations_item_test.rb +0 -10
- data/test/test_all.rb +0 -16
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
2
|
+
require 'action_controller'
|
3
|
+
|
4
|
+
Rails::Initializer.run do |config|
|
5
|
+
|
6
|
+
if ActionController::Base.respond_to? 'session='
|
7
|
+
config.action_controller.session = {:session_key => '_app_session', :secret => '22cde4d5c1a61ba69a81795322cde4d5c1a61ba69a817953'}
|
8
|
+
end
|
9
|
+
|
10
|
+
config.load_paths << "#{RAILS_ROOT}/app/models/person" # moduleless model path
|
11
|
+
|
12
|
+
config.after_initialize do
|
13
|
+
config.has_many_polymorphs_options['requirements'] << "#{RAILS_ROOT}/lib/library_model"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Dependencies.log_activity = true
|
18
|
+
|
19
|
+
ENV['RAILS_ASSET_ID'] = Time.now.to_i.to_s
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
config.cache_classes = ENV['PRODUCTION']
|
2
3
|
config.whiny_nils = true
|
3
|
-
config.action_controller.consider_all_requests_local =
|
4
|
-
config.action_controller.perform_caching
|
5
|
-
config.action_view.cache_template_extensions
|
6
|
-
config.action_view.debug_rjs
|
4
|
+
config.action_controller.consider_all_requests_local = !ENV['PRODUCTION']
|
5
|
+
config.action_controller.perform_caching = ENV['PRODUCTION']
|
6
|
+
config.action_view.cache_template_extensions = ENV['PRODUCTION']
|
7
|
+
config.action_view.debug_rjs = !ENV['PRODUCTION']
|
7
8
|
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateSingleStiParentRelationships < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :single_sti_parent_relationships do |t|
|
4
|
+
t.column :the_bone_type, :string, :null => false
|
5
|
+
t.column :the_bone_id, :integer, :null => false
|
6
|
+
t.column :single_sti_parent_id, :integer, :null => false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table :single_sti_parent_relationships
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateDoubleStiParentRelationships < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :double_sti_parent_relationships do |t|
|
4
|
+
t.column :the_bone_type, :string, :null => false
|
5
|
+
t.column :the_bone_id, :integer, :null => false
|
6
|
+
t.column :parent_type, :string, :null => false
|
7
|
+
t.column :parent_id, :integer, :null => false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table :double_sti_parent_relationships
|
13
|
+
end
|
14
|
+
end
|
@@ -4,141 +4,41 @@
|
|
4
4
|
|
5
5
|
ActiveRecord::Schema.define(:version => 9) do
|
6
6
|
|
7
|
-
create_table "
|
8
|
-
t.
|
9
|
-
t.
|
10
|
-
t.
|
11
|
-
t.
|
12
|
-
t.string "city", :default => "", :null => false
|
13
|
-
t.integer "state_id", :null => false
|
14
|
-
t.string "province_region"
|
15
|
-
t.string "zip_postal_code"
|
16
|
-
t.integer "country_id", :null => false
|
17
|
-
t.float "lat"
|
18
|
-
t.float "long"
|
7
|
+
create_table "double_sti_parent_relationships", :force => true do |t|
|
8
|
+
t.column "the_bone_type", :string, :default => "", :null => false
|
9
|
+
t.column "the_bone_id", :integer, :null => false
|
10
|
+
t.column "parent_type", :string, :default => "", :null => false
|
11
|
+
t.column "parent_id", :integer, :null => false
|
19
12
|
end
|
20
13
|
|
21
|
-
create_table "
|
22
|
-
t.
|
23
|
-
t.datetime "created_at", :null => false
|
24
|
-
t.datetime "updated_at", :null => false
|
14
|
+
create_table "double_sti_parents", :force => true do |t|
|
15
|
+
t.column "name", :string
|
25
16
|
end
|
26
17
|
|
27
|
-
create_table "
|
28
|
-
t.
|
29
|
-
t.string "cat_type"
|
30
|
-
t.datetime "created_at", :null => false
|
31
|
-
t.datetime "updated_at", :null => false
|
18
|
+
create_table "library_models", :force => true do |t|
|
19
|
+
t.column "name", :string
|
32
20
|
end
|
33
21
|
|
34
|
-
create_table "
|
35
|
-
t.
|
36
|
-
t.datetime "created_at"
|
37
|
-
t.datetime "updated_at"
|
22
|
+
create_table "organic_substances", :force => true do |t|
|
23
|
+
t.column "type", :string
|
38
24
|
end
|
39
25
|
|
40
|
-
create_table "
|
41
|
-
t.
|
42
|
-
t.
|
43
|
-
t.
|
44
|
-
t.datetime "created_at"
|
45
|
-
t.datetime "updated_at"
|
26
|
+
create_table "single_sti_parent_relationships", :force => true do |t|
|
27
|
+
t.column "the_bone_type", :string, :default => "", :null => false
|
28
|
+
t.column "the_bone_id", :integer, :null => false
|
29
|
+
t.column "single_sti_parent_id", :integer, :null => false
|
46
30
|
end
|
47
31
|
|
48
|
-
create_table "
|
49
|
-
t.
|
50
|
-
t.integer "eater_id"
|
51
|
-
t.integer "some_attribute", :default => 0
|
52
|
-
t.string "eater_type"
|
53
|
-
t.datetime "created_at", :null => false
|
54
|
-
t.datetime "updated_at", :null => false
|
32
|
+
create_table "single_sti_parents", :force => true do |t|
|
33
|
+
t.column "name", :string
|
55
34
|
end
|
56
35
|
|
57
|
-
create_table "
|
58
|
-
t.
|
59
|
-
t.integer "speed"
|
60
|
-
t.datetime "created_at", :null => false
|
61
|
-
t.datetime "updated_at", :null => false
|
36
|
+
create_table "sticks", :force => true do |t|
|
37
|
+
t.column "name", :string
|
62
38
|
end
|
63
39
|
|
64
|
-
create_table "
|
65
|
-
t.
|
66
|
-
t.datetime "created_at", :null => false
|
67
|
-
t.datetime "updated_at", :null => false
|
68
|
-
end
|
69
|
-
|
70
|
-
create_table "keep_your_enemies_close", :force => true do |t|
|
71
|
-
t.integer "enemy_id"
|
72
|
-
t.string "enemy_type"
|
73
|
-
t.integer "protector_id"
|
74
|
-
t.string "protector_type"
|
75
|
-
t.datetime "created_at", :null => false
|
76
|
-
t.datetime "updated_at", :null => false
|
77
|
-
end
|
78
|
-
|
79
|
-
create_table "little_whale_pupils", :force => true do |t|
|
80
|
-
t.integer "whale_id"
|
81
|
-
t.integer "aquatic_pupil_id"
|
82
|
-
t.string "aquatic_pupil_type"
|
83
|
-
t.datetime "created_at", :null => false
|
84
|
-
t.datetime "updated_at", :null => false
|
85
|
-
end
|
86
|
-
|
87
|
-
create_table "parentships", :force => true do |t|
|
88
|
-
t.integer "parent_id"
|
89
|
-
t.string "child_type"
|
90
|
-
t.integer "kid_id"
|
91
|
-
t.datetime "created_at", :null => false
|
92
|
-
t.datetime "updated_at", :null => false
|
93
|
-
end
|
94
|
-
|
95
|
-
create_table "people", :force => true do |t|
|
96
|
-
t.string "name"
|
97
|
-
t.integer "age"
|
98
|
-
t.datetime "created_at", :null => false
|
99
|
-
t.datetime "updated_at", :null => false
|
100
|
-
end
|
101
|
-
|
102
|
-
create_table "petfoods", :id => false, :force => true do |t|
|
103
|
-
t.integer "the_petfood_primary_key", :null => false
|
104
|
-
t.string "name"
|
105
|
-
t.datetime "created_at", :null => false
|
106
|
-
t.datetime "updated_at", :null => false
|
107
|
-
end
|
108
|
-
|
109
|
-
create_table "sellers", :force => true do |t|
|
110
|
-
t.integer "user_id", :null => false
|
111
|
-
t.string "company_name"
|
112
|
-
t.datetime "created_at"
|
113
|
-
t.datetime "updated_at"
|
114
|
-
t.float "capitalization", :default => 0.0
|
115
|
-
end
|
116
|
-
|
117
|
-
create_table "states", :force => true do |t|
|
118
|
-
t.string "name", :default => "", :null => false
|
119
|
-
t.string "abbreviation", :default => "", :null => false
|
120
|
-
end
|
121
|
-
|
122
|
-
create_table "users", :force => true do |t|
|
123
|
-
t.string "login", :limit => 64, :default => "", :null => false
|
124
|
-
t.string "email", :default => "", :null => false
|
125
|
-
t.string "crypted_password", :limit => 64, :default => "", :null => false
|
126
|
-
t.string "salt", :limit => 64, :default => "", :null => false
|
127
|
-
t.datetime "created_at"
|
128
|
-
t.datetime "updated_at"
|
129
|
-
t.boolean "deleted", :default => false
|
130
|
-
end
|
131
|
-
|
132
|
-
create_table "whales", :force => true do |t|
|
133
|
-
t.string "name"
|
134
|
-
t.datetime "created_at", :null => false
|
135
|
-
t.datetime "updated_at", :null => false
|
136
|
-
end
|
137
|
-
|
138
|
-
create_table "wild_boars", :force => true do |t|
|
139
|
-
t.string "name"
|
140
|
-
t.datetime "created_at", :null => false
|
141
|
-
t.datetime "updated_at", :null => false
|
40
|
+
create_table "stones", :force => true do |t|
|
41
|
+
t.column "name", :string
|
142
42
|
end
|
143
43
|
|
144
44
|
end
|
Binary file
|
@@ -1,28 +1,8 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "
|
1
|
+
ENV["RAILS_ENV"] = "development"
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
3
|
require 'test_help'
|
4
4
|
|
5
5
|
class Test::Unit::TestCase
|
6
|
-
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
-
# between every test method. Fewer database queries means faster tests.
|
10
|
-
#
|
11
|
-
# Read Mike Clark's excellent walkthrough at
|
12
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
-
#
|
14
|
-
# Every Active Record database supports transactions except MyISAM tables
|
15
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
-
# is recommended.
|
18
6
|
self.use_transactional_fixtures = true
|
19
|
-
|
20
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
21
|
-
# would need people(:david). If you don't want to migrate your existing
|
22
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
23
|
-
# instantiated fixtures translates to a database query per test method),
|
24
|
-
# then set this back to true.
|
25
7
|
self.use_instantiated_fixtures = false
|
26
|
-
|
27
|
-
# Add more helper methods to be used by all tests here...
|
28
8
|
end
|