activerecord 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG +4928 -3
- data/README +45 -46
- data/RUNNING_UNIT_TESTS +8 -11
- data/Rakefile +247 -0
- data/install.rb +8 -38
- data/lib/active_record/aggregations.rb +64 -49
- data/lib/active_record/associations/association_collection.rb +217 -47
- data/lib/active_record/associations/association_proxy.rb +159 -0
- data/lib/active_record/associations/belongs_to_association.rb +56 -0
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +155 -37
- data/lib/active_record/associations/has_many_association.rb +145 -75
- data/lib/active_record/associations/has_many_through_association.rb +283 -0
- data/lib/active_record/associations/has_one_association.rb +96 -0
- data/lib/active_record/associations.rb +1537 -304
- data/lib/active_record/attribute_methods.rb +328 -0
- data/lib/active_record/base.rb +2001 -588
- data/lib/active_record/calculations.rb +269 -0
- data/lib/active_record/callbacks.rb +169 -165
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +308 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +171 -0
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +87 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +472 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +306 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +125 -279
- data/lib/active_record/connection_adapters/mysql_adapter.rb +442 -77
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +805 -135
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +353 -69
- data/lib/active_record/fixtures.rb +946 -100
- data/lib/active_record/locking/optimistic.rb +144 -0
- data/lib/active_record/locking/pessimistic.rb +77 -0
- data/lib/active_record/migration.rb +417 -0
- data/lib/active_record/observer.rb +142 -32
- data/lib/active_record/query_cache.rb +23 -0
- data/lib/active_record/reflection.rb +163 -70
- data/lib/active_record/schema.rb +58 -0
- data/lib/active_record/schema_dumper.rb +171 -0
- data/lib/active_record/serialization.rb +98 -0
- data/lib/active_record/serializers/json_serializer.rb +71 -0
- data/lib/active_record/serializers/xml_serializer.rb +315 -0
- data/lib/active_record/timestamp.rb +41 -0
- data/lib/active_record/transactions.rb +87 -57
- data/lib/active_record/validations.rb +909 -122
- data/lib/active_record/vendor/db2.rb +362 -0
- data/lib/active_record/vendor/mysql.rb +126 -29
- data/lib/active_record/version.rb +9 -0
- data/lib/active_record.rb +35 -7
- data/lib/activerecord.rb +1 -0
- data/test/aaa_create_tables_test.rb +72 -0
- data/test/abstract_unit.rb +73 -5
- data/test/active_schema_test_mysql.rb +43 -0
- data/test/adapter_test.rb +105 -0
- data/test/adapter_test_sqlserver.rb +95 -0
- data/test/aggregations_test.rb +110 -16
- data/test/all.sh +2 -2
- data/test/ar_schema_test.rb +33 -0
- data/test/association_inheritance_reload.rb +14 -0
- data/test/associations/ar_joins_test.rb +0 -0
- data/test/associations/callbacks_test.rb +147 -0
- data/test/associations/cascaded_eager_loading_test.rb +110 -0
- data/test/associations/eager_singularization_test.rb +145 -0
- data/test/associations/eager_test.rb +442 -0
- data/test/associations/extension_test.rb +47 -0
- data/test/associations/inner_join_association_test.rb +88 -0
- data/test/associations/join_model_test.rb +553 -0
- data/test/associations_test.rb +1930 -267
- data/test/attribute_methods_test.rb +146 -0
- data/test/base_test.rb +1316 -84
- data/test/binary_test.rb +32 -0
- data/test/calculations_test.rb +251 -0
- data/test/callbacks_test.rb +400 -0
- data/test/class_inheritable_attributes_test.rb +3 -4
- data/test/column_alias_test.rb +17 -0
- data/test/connection_test_firebird.rb +8 -0
- data/test/connection_test_mysql.rb +30 -0
- data/test/connections/native_db2/connection.rb +25 -0
- data/test/connections/native_firebird/connection.rb +26 -0
- data/test/connections/native_frontbase/connection.rb +27 -0
- data/test/connections/native_mysql/connection.rb +21 -18
- data/test/connections/native_openbase/connection.rb +21 -0
- data/test/connections/native_oracle/connection.rb +27 -0
- data/test/connections/native_postgresql/connection.rb +17 -18
- data/test/connections/native_sqlite/connection.rb +17 -16
- data/test/connections/native_sqlite3/connection.rb +25 -0
- data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/test/connections/native_sybase/connection.rb +23 -0
- data/test/copy_table_test_sqlite.rb +69 -0
- data/test/datatype_test_postgresql.rb +203 -0
- data/test/date_time_test.rb +37 -0
- data/test/default_test_firebird.rb +16 -0
- data/test/defaults_test.rb +67 -0
- data/test/deprecated_finder_test.rb +30 -0
- data/test/finder_test.rb +607 -32
- data/test/fixtures/accounts.yml +28 -0
- data/test/fixtures/all/developers.yml +0 -0
- data/test/fixtures/all/people.csv +0 -0
- data/test/fixtures/all/tasks.yml +0 -0
- data/test/fixtures/author.rb +107 -0
- data/test/fixtures/author_favorites.yml +4 -0
- data/test/fixtures/authors.yml +7 -0
- data/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
- data/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
- data/test/fixtures/bad_fixtures/blank_line +3 -0
- data/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
- data/test/fixtures/bad_fixtures/missing_value +1 -0
- data/test/fixtures/binaries.yml +132 -0
- data/test/fixtures/binary.rb +2 -0
- data/test/fixtures/book.rb +4 -0
- data/test/fixtures/books.yml +7 -0
- data/test/fixtures/categories/special_categories.yml +9 -0
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/test/fixtures/categories.yml +14 -0
- data/test/fixtures/categories_ordered.yml +7 -0
- data/test/fixtures/categories_posts.yml +23 -0
- data/test/fixtures/categorization.rb +5 -0
- data/test/fixtures/categorizations.yml +17 -0
- data/test/fixtures/category.rb +26 -0
- data/test/fixtures/citation.rb +6 -0
- data/test/fixtures/comment.rb +23 -0
- data/test/fixtures/comments.yml +59 -0
- data/test/fixtures/companies.yml +55 -0
- data/test/fixtures/company.rb +81 -4
- data/test/fixtures/company_in_module.rb +32 -6
- data/test/fixtures/computer.rb +4 -0
- data/test/fixtures/computers.yml +4 -0
- data/test/fixtures/contact.rb +16 -0
- data/test/fixtures/courses.yml +7 -0
- data/test/fixtures/customer.rb +28 -3
- data/test/fixtures/customers.yml +17 -0
- data/test/fixtures/db_definitions/db2.drop.sql +33 -0
- data/test/fixtures/db_definitions/db2.sql +235 -0
- data/test/fixtures/db_definitions/db22.drop.sql +2 -0
- data/test/fixtures/db_definitions/db22.sql +5 -0
- data/test/fixtures/db_definitions/firebird.drop.sql +65 -0
- data/test/fixtures/db_definitions/firebird.sql +310 -0
- data/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
- data/test/fixtures/db_definitions/firebird2.sql +6 -0
- data/test/fixtures/db_definitions/frontbase.drop.sql +33 -0
- data/test/fixtures/db_definitions/frontbase.sql +273 -0
- data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
- data/test/fixtures/db_definitions/frontbase2.sql +4 -0
- data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase.sql +318 -0
- data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
- data/test/fixtures/db_definitions/openbase2.sql +7 -0
- data/test/fixtures/db_definitions/oracle.drop.sql +67 -0
- data/test/fixtures/db_definitions/oracle.sql +330 -0
- data/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
- data/test/fixtures/db_definitions/oracle2.sql +6 -0
- data/test/fixtures/db_definitions/postgresql.drop.sql +44 -0
- data/test/fixtures/db_definitions/postgresql.sql +217 -38
- data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/postgresql2.sql +2 -2
- data/test/fixtures/db_definitions/schema.rb +354 -0
- data/test/fixtures/db_definitions/schema2.rb +11 -0
- data/test/fixtures/db_definitions/sqlite.drop.sql +33 -0
- data/test/fixtures/db_definitions/sqlite.sql +139 -5
- data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
- data/test/fixtures/db_definitions/sqlite2.sql +1 -0
- data/test/fixtures/db_definitions/sybase.drop.sql +35 -0
- data/test/fixtures/db_definitions/sybase.sql +222 -0
- data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
- data/test/fixtures/db_definitions/sybase2.sql +5 -0
- data/test/fixtures/developer.rb +70 -6
- data/test/fixtures/developers.yml +21 -0
- data/test/fixtures/developers_projects/david_action_controller +2 -1
- data/test/fixtures/developers_projects/david_active_record +2 -1
- data/test/fixtures/developers_projects.yml +17 -0
- data/test/fixtures/edge.rb +5 -0
- data/test/fixtures/edges.yml +6 -0
- data/test/fixtures/entrants.yml +14 -0
- data/test/fixtures/example.log +1 -0
- data/test/fixtures/fk_test_has_fk.yml +3 -0
- data/test/fixtures/fk_test_has_pk.yml +2 -0
- data/test/fixtures/flowers.jpg +0 -0
- data/test/fixtures/funny_jokes.yml +10 -0
- data/test/fixtures/item.rb +7 -0
- data/test/fixtures/items.yml +4 -0
- data/test/fixtures/joke.rb +3 -0
- data/test/fixtures/keyboard.rb +3 -0
- data/test/fixtures/legacy_thing.rb +3 -0
- data/test/fixtures/legacy_things.yml +3 -0
- data/test/fixtures/matey.rb +4 -0
- data/test/fixtures/mateys.yml +4 -0
- data/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
- data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
- data/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
- data/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
- data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
- data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
- data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
- data/test/fixtures/minimalistic.rb +2 -0
- data/test/fixtures/minimalistics.yml +2 -0
- data/test/fixtures/mixed_case_monkey.rb +3 -0
- data/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/test/fixtures/mixins.yml +29 -0
- data/test/fixtures/movies.yml +7 -0
- data/test/fixtures/naked/csv/accounts.csv +1 -0
- data/test/fixtures/naked/yml/accounts.yml +1 -0
- data/test/fixtures/naked/yml/companies.yml +1 -0
- data/test/fixtures/naked/yml/courses.yml +1 -0
- data/test/fixtures/order.rb +4 -0
- data/test/fixtures/parrot.rb +13 -0
- data/test/fixtures/parrots.yml +27 -0
- data/test/fixtures/parrots_pirates.yml +7 -0
- data/test/fixtures/people.yml +3 -0
- data/test/fixtures/person.rb +4 -0
- data/test/fixtures/pirate.rb +5 -0
- data/test/fixtures/pirates.yml +9 -0
- data/test/fixtures/post.rb +59 -0
- data/test/fixtures/posts.yml +48 -0
- data/test/fixtures/project.rb +27 -2
- data/test/fixtures/projects.yml +7 -0
- data/test/fixtures/reader.rb +4 -0
- data/test/fixtures/readers.yml +4 -0
- data/test/fixtures/reply.rb +18 -2
- data/test/fixtures/reserved_words/distinct.yml +5 -0
- data/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/test/fixtures/reserved_words/group.yml +14 -0
- data/test/fixtures/reserved_words/select.yml +8 -0
- data/test/fixtures/reserved_words/values.yml +7 -0
- data/test/fixtures/ship.rb +3 -0
- data/test/fixtures/ships.yml +5 -0
- data/test/fixtures/subject.rb +4 -0
- data/test/fixtures/subscriber.rb +4 -3
- data/test/fixtures/tag.rb +7 -0
- data/test/fixtures/tagging.rb +10 -0
- data/test/fixtures/taggings.yml +25 -0
- data/test/fixtures/tags.yml +7 -0
- data/test/fixtures/task.rb +3 -0
- data/test/fixtures/tasks.yml +7 -0
- data/test/fixtures/topic.rb +20 -3
- data/test/fixtures/topics.yml +22 -0
- data/test/fixtures/treasure.rb +4 -0
- data/test/fixtures/treasures.yml +10 -0
- data/test/fixtures/vertex.rb +9 -0
- data/test/fixtures/vertices.yml +4 -0
- data/test/fixtures_test.rb +574 -8
- data/test/inheritance_test.rb +113 -27
- data/test/json_serialization_test.rb +180 -0
- data/test/lifecycle_test.rb +56 -29
- data/test/locking_test.rb +273 -0
- data/test/method_scoping_test.rb +416 -0
- data/test/migration_test.rb +933 -0
- data/test/migration_test_firebird.rb +124 -0
- data/test/mixin_test.rb +95 -0
- data/test/modules_test.rb +23 -10
- data/test/multiple_db_test.rb +17 -3
- data/test/pk_test.rb +59 -15
- data/test/query_cache_test.rb +104 -0
- data/test/readonly_test.rb +107 -0
- data/test/reflection_test.rb +124 -27
- data/test/reserved_word_test_mysql.rb +177 -0
- data/test/schema_authorization_test_postgresql.rb +75 -0
- data/test/schema_dumper_test.rb +131 -0
- data/test/schema_test_postgresql.rb +64 -0
- data/test/serialization_test.rb +47 -0
- data/test/synonym_test_oracle.rb +17 -0
- data/test/table_name_test_sqlserver.rb +23 -0
- data/test/threaded_connections_test.rb +48 -0
- data/test/transactions_test.rb +227 -29
- data/test/unconnected_test.rb +14 -6
- data/test/validations_test.rb +1293 -32
- data/test/xml_serialization_test.rb +202 -0
- metadata +347 -143
- data/dev-utils/eval_debugger.rb +0 -9
- data/examples/associations.rb +0 -87
- data/examples/shared_setup.rb +0 -15
- data/examples/validation.rb +0 -88
- data/lib/active_record/deprecated_associations.rb +0 -70
- data/lib/active_record/support/class_attribute_accessors.rb +0 -43
- data/lib/active_record/support/class_inheritable_attributes.rb +0 -37
- data/lib/active_record/support/clean_logger.rb +0 -10
- data/lib/active_record/support/inflector.rb +0 -70
- data/lib/active_record/vendor/simple.rb +0 -702
- data/lib/active_record/wrappers/yaml_wrapper.rb +0 -15
- data/lib/active_record/wrappings.rb +0 -59
- data/rakefile +0 -122
- data/test/deprecated_associations_test.rb +0 -336
- data/test/fixtures/accounts/signals37 +0 -3
- data/test/fixtures/accounts/unknown +0 -2
- data/test/fixtures/companies/first_client +0 -6
- data/test/fixtures/companies/first_firm +0 -4
- data/test/fixtures/companies/second_client +0 -6
- data/test/fixtures/courses/java +0 -2
- data/test/fixtures/courses/ruby +0 -2
- data/test/fixtures/customers/david +0 -6
- data/test/fixtures/db_definitions/mysql.sql +0 -96
- data/test/fixtures/db_definitions/mysql2.sql +0 -4
- data/test/fixtures/developers/david +0 -2
- data/test/fixtures/developers/jamis +0 -2
- data/test/fixtures/entrants/first +0 -3
- data/test/fixtures/entrants/second +0 -3
- data/test/fixtures/entrants/third +0 -3
- data/test/fixtures/fixture_database.sqlite +0 -0
- data/test/fixtures/fixture_database_2.sqlite +0 -0
- data/test/fixtures/movies/first +0 -2
- data/test/fixtures/movies/second +0 -2
- data/test/fixtures/projects/action_controller +0 -2
- data/test/fixtures/projects/active_record +0 -2
- data/test/fixtures/topics/first +0 -9
- data/test/fixtures/topics/second +0 -8
- data/test/inflector_test.rb +0 -104
- data/test/thread_safety_test.rb +0 -33
metadata
CHANGED
@@ -1,166 +1,370 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: activerecord
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date:
|
6
|
+
version: 2.0.0
|
7
|
+
date: 2007-12-06 00:00:00 -06:00
|
8
8
|
summary: Implements the ActiveRecord pattern for ORM.
|
9
9
|
require_paths:
|
10
|
-
|
11
|
-
author: David Heinemeier Hansson
|
10
|
+
- lib
|
12
11
|
email: david@loudthinking.com
|
13
|
-
homepage: http://
|
12
|
+
homepage: http://www.rubyonrails.org
|
14
13
|
rubyforge_project: activerecord
|
15
|
-
description:
|
14
|
+
description: Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database tables and classes together for business objects, like Customer or Subscription, that can find, save, and destroy themselves without resorting to manual SQL.
|
16
15
|
autorequire: active_record
|
17
16
|
default_executable:
|
18
17
|
bindir: bin
|
19
18
|
has_rdoc: true
|
20
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
20
|
requirements:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
26
24
|
version:
|
27
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- David Heinemeier Hansson
|
28
31
|
files:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
32
|
+
- Rakefile
|
33
|
+
- install.rb
|
34
|
+
- README
|
35
|
+
- RUNNING_UNIT_TESTS
|
36
|
+
- CHANGELOG
|
37
|
+
- lib/active_record
|
38
|
+
- lib/active_record/aggregations.rb
|
39
|
+
- lib/active_record/associations
|
40
|
+
- lib/active_record/associations/association_collection.rb
|
41
|
+
- lib/active_record/associations/association_proxy.rb
|
42
|
+
- lib/active_record/associations/belongs_to_association.rb
|
43
|
+
- lib/active_record/associations/belongs_to_polymorphic_association.rb
|
44
|
+
- lib/active_record/associations/has_and_belongs_to_many_association.rb
|
45
|
+
- lib/active_record/associations/has_many_association.rb
|
46
|
+
- lib/active_record/associations/has_many_through_association.rb
|
47
|
+
- lib/active_record/associations/has_one_association.rb
|
48
|
+
- lib/active_record/associations.rb
|
49
|
+
- lib/active_record/attribute_methods.rb
|
50
|
+
- lib/active_record/base.rb
|
51
|
+
- lib/active_record/calculations.rb
|
52
|
+
- lib/active_record/callbacks.rb
|
53
|
+
- lib/active_record/connection_adapters
|
54
|
+
- lib/active_record/connection_adapters/abstract
|
55
|
+
- lib/active_record/connection_adapters/abstract/connection_specification.rb
|
56
|
+
- lib/active_record/connection_adapters/abstract/database_statements.rb
|
57
|
+
- lib/active_record/connection_adapters/abstract/query_cache.rb
|
58
|
+
- lib/active_record/connection_adapters/abstract/quoting.rb
|
59
|
+
- lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
60
|
+
- lib/active_record/connection_adapters/abstract/schema_statements.rb
|
61
|
+
- lib/active_record/connection_adapters/abstract_adapter.rb
|
62
|
+
- lib/active_record/connection_adapters/mysql_adapter.rb
|
63
|
+
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
64
|
+
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
65
|
+
- lib/active_record/connection_adapters/sqlite_adapter.rb
|
66
|
+
- lib/active_record/fixtures.rb
|
67
|
+
- lib/active_record/locking
|
68
|
+
- lib/active_record/locking/optimistic.rb
|
69
|
+
- lib/active_record/locking/pessimistic.rb
|
70
|
+
- lib/active_record/migration.rb
|
71
|
+
- lib/active_record/observer.rb
|
72
|
+
- lib/active_record/query_cache.rb
|
73
|
+
- lib/active_record/reflection.rb
|
74
|
+
- lib/active_record/schema.rb
|
75
|
+
- lib/active_record/schema_dumper.rb
|
76
|
+
- lib/active_record/serialization.rb
|
77
|
+
- lib/active_record/serializers
|
78
|
+
- lib/active_record/serializers/json_serializer.rb
|
79
|
+
- lib/active_record/serializers/xml_serializer.rb
|
80
|
+
- lib/active_record/timestamp.rb
|
81
|
+
- lib/active_record/transactions.rb
|
82
|
+
- lib/active_record/validations.rb
|
83
|
+
- lib/active_record/vendor
|
84
|
+
- lib/active_record/vendor/db2.rb
|
85
|
+
- lib/active_record/vendor/mysql.rb
|
86
|
+
- lib/active_record/version.rb
|
87
|
+
- lib/active_record.rb
|
88
|
+
- lib/activerecord.rb
|
89
|
+
- test/aaa_create_tables_test.rb
|
90
|
+
- test/abstract_unit.rb
|
91
|
+
- test/active_schema_test_mysql.rb
|
92
|
+
- test/adapter_test.rb
|
93
|
+
- test/adapter_test_sqlserver.rb
|
94
|
+
- test/aggregations_test.rb
|
95
|
+
- test/all.sh
|
96
|
+
- test/ar_schema_test.rb
|
97
|
+
- test/association_inheritance_reload.rb
|
98
|
+
- test/associations
|
99
|
+
- test/associations/ar_joins_test.rb
|
100
|
+
- test/associations/callbacks_test.rb
|
101
|
+
- test/associations/cascaded_eager_loading_test.rb
|
102
|
+
- test/associations/eager_singularization_test.rb
|
103
|
+
- test/associations/eager_test.rb
|
104
|
+
- test/associations/extension_test.rb
|
105
|
+
- test/associations/inner_join_association_test.rb
|
106
|
+
- test/associations/join_model_test.rb
|
107
|
+
- test/associations_test.rb
|
108
|
+
- test/attribute_methods_test.rb
|
109
|
+
- test/base_test.rb
|
110
|
+
- test/binary_test.rb
|
111
|
+
- test/calculations_test.rb
|
112
|
+
- test/callbacks_test.rb
|
113
|
+
- test/class_inheritable_attributes_test.rb
|
114
|
+
- test/column_alias_test.rb
|
115
|
+
- test/connection_test_firebird.rb
|
116
|
+
- test/connection_test_mysql.rb
|
117
|
+
- test/connections
|
118
|
+
- test/connections/native_db2
|
119
|
+
- test/connections/native_db2/connection.rb
|
120
|
+
- test/connections/native_firebird
|
121
|
+
- test/connections/native_firebird/connection.rb
|
122
|
+
- test/connections/native_frontbase
|
123
|
+
- test/connections/native_frontbase/connection.rb
|
124
|
+
- test/connections/native_mysql
|
125
|
+
- test/connections/native_mysql/connection.rb
|
126
|
+
- test/connections/native_openbase
|
127
|
+
- test/connections/native_openbase/connection.rb
|
128
|
+
- test/connections/native_oracle
|
129
|
+
- test/connections/native_oracle/connection.rb
|
130
|
+
- test/connections/native_postgresql
|
131
|
+
- test/connections/native_postgresql/connection.rb
|
132
|
+
- test/connections/native_sqlite
|
133
|
+
- test/connections/native_sqlite/connection.rb
|
134
|
+
- test/connections/native_sqlite3
|
135
|
+
- test/connections/native_sqlite3/connection.rb
|
136
|
+
- test/connections/native_sqlite3/in_memory_connection.rb
|
137
|
+
- test/connections/native_sybase
|
138
|
+
- test/connections/native_sybase/connection.rb
|
139
|
+
- test/copy_table_test_sqlite.rb
|
140
|
+
- test/datatype_test_postgresql.rb
|
141
|
+
- test/date_time_test.rb
|
142
|
+
- test/default_test_firebird.rb
|
143
|
+
- test/defaults_test.rb
|
144
|
+
- test/deprecated_finder_test.rb
|
145
|
+
- test/finder_test.rb
|
146
|
+
- test/fixtures
|
147
|
+
- test/fixtures/accounts.yml
|
148
|
+
- test/fixtures/all
|
149
|
+
- test/fixtures/all/developers.yml
|
150
|
+
- test/fixtures/all/people.csv
|
151
|
+
- test/fixtures/all/tasks.yml
|
152
|
+
- test/fixtures/author.rb
|
153
|
+
- test/fixtures/author_favorites.yml
|
154
|
+
- test/fixtures/authors.yml
|
155
|
+
- test/fixtures/auto_id.rb
|
156
|
+
- test/fixtures/bad_fixtures
|
157
|
+
- test/fixtures/bad_fixtures/attr_with_numeric_first_char
|
158
|
+
- test/fixtures/bad_fixtures/attr_with_spaces
|
159
|
+
- test/fixtures/bad_fixtures/blank_line
|
160
|
+
- test/fixtures/bad_fixtures/duplicate_attributes
|
161
|
+
- test/fixtures/bad_fixtures/missing_value
|
162
|
+
- test/fixtures/binaries.yml
|
163
|
+
- test/fixtures/binary.rb
|
164
|
+
- test/fixtures/book.rb
|
165
|
+
- test/fixtures/books.yml
|
166
|
+
- test/fixtures/categories
|
167
|
+
- test/fixtures/categories/special_categories.yml
|
168
|
+
- test/fixtures/categories/subsubdir
|
169
|
+
- test/fixtures/categories/subsubdir/arbitrary_filename.yml
|
170
|
+
- test/fixtures/categories.yml
|
171
|
+
- test/fixtures/categories_ordered.yml
|
172
|
+
- test/fixtures/categories_posts.yml
|
173
|
+
- test/fixtures/categorization.rb
|
174
|
+
- test/fixtures/categorizations.yml
|
175
|
+
- test/fixtures/category.rb
|
176
|
+
- test/fixtures/citation.rb
|
177
|
+
- test/fixtures/column_name.rb
|
178
|
+
- test/fixtures/comment.rb
|
179
|
+
- test/fixtures/comments.yml
|
180
|
+
- test/fixtures/companies.yml
|
181
|
+
- test/fixtures/company.rb
|
182
|
+
- test/fixtures/company_in_module.rb
|
183
|
+
- test/fixtures/computer.rb
|
184
|
+
- test/fixtures/computers.yml
|
185
|
+
- test/fixtures/contact.rb
|
186
|
+
- test/fixtures/course.rb
|
187
|
+
- test/fixtures/courses.yml
|
188
|
+
- test/fixtures/customer.rb
|
189
|
+
- test/fixtures/customers.yml
|
190
|
+
- test/fixtures/db_definitions
|
191
|
+
- test/fixtures/db_definitions/db2.drop.sql
|
192
|
+
- test/fixtures/db_definitions/db2.sql
|
193
|
+
- test/fixtures/db_definitions/db22.drop.sql
|
194
|
+
- test/fixtures/db_definitions/db22.sql
|
195
|
+
- test/fixtures/db_definitions/firebird.drop.sql
|
196
|
+
- test/fixtures/db_definitions/firebird.sql
|
197
|
+
- test/fixtures/db_definitions/firebird2.drop.sql
|
198
|
+
- test/fixtures/db_definitions/firebird2.sql
|
199
|
+
- test/fixtures/db_definitions/frontbase.drop.sql
|
200
|
+
- test/fixtures/db_definitions/frontbase.sql
|
201
|
+
- test/fixtures/db_definitions/frontbase2.drop.sql
|
202
|
+
- test/fixtures/db_definitions/frontbase2.sql
|
203
|
+
- test/fixtures/db_definitions/openbase.drop.sql
|
204
|
+
- test/fixtures/db_definitions/openbase.sql
|
205
|
+
- test/fixtures/db_definitions/openbase2.drop.sql
|
206
|
+
- test/fixtures/db_definitions/openbase2.sql
|
207
|
+
- test/fixtures/db_definitions/oracle.drop.sql
|
208
|
+
- test/fixtures/db_definitions/oracle.sql
|
209
|
+
- test/fixtures/db_definitions/oracle2.drop.sql
|
210
|
+
- test/fixtures/db_definitions/oracle2.sql
|
211
|
+
- test/fixtures/db_definitions/postgresql.drop.sql
|
212
|
+
- test/fixtures/db_definitions/postgresql.sql
|
213
|
+
- test/fixtures/db_definitions/postgresql2.drop.sql
|
214
|
+
- test/fixtures/db_definitions/postgresql2.sql
|
215
|
+
- test/fixtures/db_definitions/schema.rb
|
216
|
+
- test/fixtures/db_definitions/schema2.rb
|
217
|
+
- test/fixtures/db_definitions/sqlite.drop.sql
|
218
|
+
- test/fixtures/db_definitions/sqlite.sql
|
219
|
+
- test/fixtures/db_definitions/sqlite2.drop.sql
|
220
|
+
- test/fixtures/db_definitions/sqlite2.sql
|
221
|
+
- test/fixtures/db_definitions/sybase.drop.sql
|
222
|
+
- test/fixtures/db_definitions/sybase.sql
|
223
|
+
- test/fixtures/db_definitions/sybase2.drop.sql
|
224
|
+
- test/fixtures/db_definitions/sybase2.sql
|
225
|
+
- test/fixtures/default.rb
|
226
|
+
- test/fixtures/developer.rb
|
227
|
+
- test/fixtures/developers.yml
|
228
|
+
- test/fixtures/developers_projects
|
229
|
+
- test/fixtures/developers_projects/david_action_controller
|
230
|
+
- test/fixtures/developers_projects/david_active_record
|
231
|
+
- test/fixtures/developers_projects/jamis_active_record
|
232
|
+
- test/fixtures/developers_projects.yml
|
233
|
+
- test/fixtures/edge.rb
|
234
|
+
- test/fixtures/edges.yml
|
235
|
+
- test/fixtures/entrant.rb
|
236
|
+
- test/fixtures/entrants.yml
|
237
|
+
- test/fixtures/example.log
|
238
|
+
- test/fixtures/fk_test_has_fk.yml
|
239
|
+
- test/fixtures/fk_test_has_pk.yml
|
240
|
+
- test/fixtures/flowers.jpg
|
241
|
+
- test/fixtures/funny_jokes.yml
|
242
|
+
- test/fixtures/item.rb
|
243
|
+
- test/fixtures/items.yml
|
244
|
+
- test/fixtures/joke.rb
|
245
|
+
- test/fixtures/keyboard.rb
|
246
|
+
- test/fixtures/legacy_thing.rb
|
247
|
+
- test/fixtures/legacy_things.yml
|
248
|
+
- test/fixtures/matey.rb
|
249
|
+
- test/fixtures/mateys.yml
|
250
|
+
- test/fixtures/migrations
|
251
|
+
- test/fixtures/migrations/1_people_have_last_names.rb
|
252
|
+
- test/fixtures/migrations/2_we_need_reminders.rb
|
253
|
+
- test/fixtures/migrations/3_innocent_jointable.rb
|
254
|
+
- test/fixtures/migrations_with_decimal
|
255
|
+
- test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb
|
256
|
+
- test/fixtures/migrations_with_duplicate
|
257
|
+
- test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb
|
258
|
+
- test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb
|
259
|
+
- test/fixtures/migrations_with_duplicate/3_foo.rb
|
260
|
+
- test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb
|
261
|
+
- test/fixtures/migrations_with_missing_versions
|
262
|
+
- test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb
|
263
|
+
- test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb
|
264
|
+
- test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb
|
265
|
+
- test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb
|
266
|
+
- test/fixtures/minimalistic.rb
|
267
|
+
- test/fixtures/minimalistics.yml
|
268
|
+
- test/fixtures/mixed_case_monkey.rb
|
269
|
+
- test/fixtures/mixed_case_monkeys.yml
|
270
|
+
- test/fixtures/mixins.yml
|
271
|
+
- test/fixtures/movie.rb
|
272
|
+
- test/fixtures/movies.yml
|
273
|
+
- test/fixtures/naked
|
274
|
+
- test/fixtures/naked/csv
|
275
|
+
- test/fixtures/naked/csv/accounts.csv
|
276
|
+
- test/fixtures/naked/yml
|
277
|
+
- test/fixtures/naked/yml/accounts.yml
|
278
|
+
- test/fixtures/naked/yml/companies.yml
|
279
|
+
- test/fixtures/naked/yml/courses.yml
|
280
|
+
- test/fixtures/order.rb
|
281
|
+
- test/fixtures/parrot.rb
|
282
|
+
- test/fixtures/parrots.yml
|
283
|
+
- test/fixtures/parrots_pirates.yml
|
284
|
+
- test/fixtures/people.yml
|
285
|
+
- test/fixtures/person.rb
|
286
|
+
- test/fixtures/pirate.rb
|
287
|
+
- test/fixtures/pirates.yml
|
288
|
+
- test/fixtures/post.rb
|
289
|
+
- test/fixtures/posts.yml
|
290
|
+
- test/fixtures/project.rb
|
291
|
+
- test/fixtures/projects.yml
|
292
|
+
- test/fixtures/reader.rb
|
293
|
+
- test/fixtures/readers.yml
|
294
|
+
- test/fixtures/reply.rb
|
295
|
+
- test/fixtures/reserved_words
|
296
|
+
- test/fixtures/reserved_words/distinct.yml
|
297
|
+
- test/fixtures/reserved_words/distincts_selects.yml
|
298
|
+
- test/fixtures/reserved_words/group.yml
|
299
|
+
- test/fixtures/reserved_words/select.yml
|
300
|
+
- test/fixtures/reserved_words/values.yml
|
301
|
+
- test/fixtures/ship.rb
|
302
|
+
- test/fixtures/ships.yml
|
303
|
+
- test/fixtures/subject.rb
|
304
|
+
- test/fixtures/subscriber.rb
|
305
|
+
- test/fixtures/subscribers
|
306
|
+
- test/fixtures/subscribers/first
|
307
|
+
- test/fixtures/subscribers/second
|
308
|
+
- test/fixtures/tag.rb
|
309
|
+
- test/fixtures/tagging.rb
|
310
|
+
- test/fixtures/taggings.yml
|
311
|
+
- test/fixtures/tags.yml
|
312
|
+
- test/fixtures/task.rb
|
313
|
+
- test/fixtures/tasks.yml
|
314
|
+
- test/fixtures/topic.rb
|
315
|
+
- test/fixtures/topics.yml
|
316
|
+
- test/fixtures/treasure.rb
|
317
|
+
- test/fixtures/treasures.yml
|
318
|
+
- test/fixtures/vertex.rb
|
319
|
+
- test/fixtures/vertices.yml
|
320
|
+
- test/fixtures_test.rb
|
321
|
+
- test/inheritance_test.rb
|
322
|
+
- test/json_serialization_test.rb
|
323
|
+
- test/lifecycle_test.rb
|
324
|
+
- test/locking_test.rb
|
325
|
+
- test/method_scoping_test.rb
|
326
|
+
- test/migration_test.rb
|
327
|
+
- test/migration_test_firebird.rb
|
328
|
+
- test/mixin_test.rb
|
329
|
+
- test/modules_test.rb
|
330
|
+
- test/multiple_db_test.rb
|
331
|
+
- test/pk_test.rb
|
332
|
+
- test/query_cache_test.rb
|
333
|
+
- test/readonly_test.rb
|
334
|
+
- test/reflection_test.rb
|
335
|
+
- test/reserved_word_test_mysql.rb
|
336
|
+
- test/schema_authorization_test_postgresql.rb
|
337
|
+
- test/schema_dumper_test.rb
|
338
|
+
- test/schema_test_postgresql.rb
|
339
|
+
- test/serialization_test.rb
|
340
|
+
- test/synonym_test_oracle.rb
|
341
|
+
- test/table_name_test_sqlserver.rb
|
342
|
+
- test/threaded_connections_test.rb
|
343
|
+
- test/transactions_test.rb
|
344
|
+
- test/unconnected_test.rb
|
345
|
+
- test/validations_test.rb
|
346
|
+
- test/xml_serialization_test.rb
|
347
|
+
- examples/associations.png
|
157
348
|
test_files: []
|
349
|
+
|
158
350
|
rdoc_options:
|
159
|
-
|
160
|
-
|
351
|
+
- --main
|
352
|
+
- README
|
161
353
|
extra_rdoc_files:
|
162
|
-
|
354
|
+
- README
|
163
355
|
executables: []
|
356
|
+
|
164
357
|
extensions: []
|
358
|
+
|
165
359
|
requirements: []
|
166
|
-
|
360
|
+
|
361
|
+
dependencies:
|
362
|
+
- !ruby/object:Gem::Dependency
|
363
|
+
name: activesupport
|
364
|
+
version_requirement:
|
365
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
366
|
+
requirements:
|
367
|
+
- - "="
|
368
|
+
- !ruby/object:Gem::Version
|
369
|
+
version: 2.0.0
|
370
|
+
version:
|
data/dev-utils/eval_debugger.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# Require the eval_debugger to get an insight into the methods that aggregations and associations macross are adding.
|
2
|
-
# All the additions are reported to $stderr just by requiring this file.
|
3
|
-
class Module
|
4
|
-
alias :old_module_eval :module_eval
|
5
|
-
def module_eval(*args, &block)
|
6
|
-
puts("in #{self.name}, #{if args[1] then "file #{args[1]}" end} #{if args[2] then "on line #{args[2]}" end}:\n#{args[0]}") if args[0]
|
7
|
-
old_module_eval(*args, &block)
|
8
|
-
end
|
9
|
-
end
|
data/examples/associations.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/shared_setup'
|
2
|
-
|
3
|
-
logger = Logger.new(STDOUT)
|
4
|
-
|
5
|
-
# Database setup ---------------
|
6
|
-
|
7
|
-
logger.info "\nCreate tables"
|
8
|
-
|
9
|
-
[ "DROP TABLE companies", "DROP TABLE people", "DROP TABLE people_companies",
|
10
|
-
"CREATE TABLE companies (id int(11) auto_increment, client_of int(11), name varchar(255), type varchar(100), PRIMARY KEY (id))",
|
11
|
-
"CREATE TABLE people (id int(11) auto_increment, name varchar(100), PRIMARY KEY (id))",
|
12
|
-
"CREATE TABLE people_companies (person_id int(11), company_id int(11), PRIMARY KEY (person_id, company_id))",
|
13
|
-
].each { |statement|
|
14
|
-
# Tables doesn't necessarily already exist
|
15
|
-
begin; ActiveRecord::Base.connection.execute(statement); rescue ActiveRecord::StatementInvalid; end
|
16
|
-
}
|
17
|
-
|
18
|
-
|
19
|
-
# Class setup ---------------
|
20
|
-
|
21
|
-
class Company < ActiveRecord::Base
|
22
|
-
has_and_belongs_to_many :people, :class_name => "Person", :join_table => "people_companies", :table_name => "people"
|
23
|
-
end
|
24
|
-
|
25
|
-
class Firm < Company
|
26
|
-
has_many :clients, :foreign_key => "client_of"
|
27
|
-
|
28
|
-
def people_with_all_clients
|
29
|
-
clients.inject([]) { |people, client| people + client.people }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Client < Company
|
34
|
-
belongs_to :firm, :foreign_key => "client_of"
|
35
|
-
end
|
36
|
-
|
37
|
-
class Person < ActiveRecord::Base
|
38
|
-
has_and_belongs_to_many :companies, :join_table => "people_companies"
|
39
|
-
def self.table_name() "people" end
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
# Usage ---------------
|
44
|
-
|
45
|
-
logger.info "\nCreate fixtures"
|
46
|
-
|
47
|
-
Firm.new("name" => "Next Angle").save
|
48
|
-
Client.new("name" => "37signals", "client_of" => 1).save
|
49
|
-
Person.new("name" => "David").save
|
50
|
-
|
51
|
-
|
52
|
-
logger.info "\nUsing Finders"
|
53
|
-
|
54
|
-
next_angle = Company.find(1)
|
55
|
-
next_angle = Firm.find(1)
|
56
|
-
next_angle = Company.find_first "name = 'Next Angle'"
|
57
|
-
next_angle = Firm.find_by_sql("SELECT * FROM companies WHERE id = 1").first
|
58
|
-
|
59
|
-
Firm === next_angle
|
60
|
-
|
61
|
-
|
62
|
-
logger.info "\nUsing has_many association"
|
63
|
-
|
64
|
-
next_angle.has_clients?
|
65
|
-
next_angle.clients_count
|
66
|
-
all_clients = next_angle.clients
|
67
|
-
|
68
|
-
thirty_seven_signals = next_angle.find_in_clients(2)
|
69
|
-
|
70
|
-
|
71
|
-
logger.info "\nUsing belongs_to association"
|
72
|
-
|
73
|
-
thirty_seven_signals.has_firm?
|
74
|
-
thirty_seven_signals.firm?(next_angle)
|
75
|
-
|
76
|
-
|
77
|
-
logger.info "\nUsing has_and_belongs_to_many association"
|
78
|
-
|
79
|
-
david = Person.find(1)
|
80
|
-
david.add_companies(thirty_seven_signals, next_angle)
|
81
|
-
david.companies.include?(next_angle)
|
82
|
-
david.companies_count == 2
|
83
|
-
|
84
|
-
david.remove_companies(next_angle)
|
85
|
-
david.companies_count == 1
|
86
|
-
|
87
|
-
thirty_seven_signals.people.include?(david)
|
data/examples/shared_setup.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# Be sure to change the mysql_connection details and create a database for the example
|
2
|
-
|
3
|
-
$: << File.dirname(__FILE__) + '/../lib'
|
4
|
-
|
5
|
-
require 'active_record'
|
6
|
-
require 'logger'; class Logger; def format_message(severity, timestamp, msg, progname) "#{msg}\n" end; end
|
7
|
-
|
8
|
-
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
9
|
-
ActiveRecord::Base.establish_connection(
|
10
|
-
:adapter => "mysql",
|
11
|
-
:host => "localhost",
|
12
|
-
:username => "root",
|
13
|
-
:password => "",
|
14
|
-
:database => "activerecord_examples"
|
15
|
-
)
|