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
@@ -0,0 +1,28 @@
|
|
1
|
+
signals37:
|
2
|
+
id: 1
|
3
|
+
firm_id: 1
|
4
|
+
credit_limit: 50
|
5
|
+
|
6
|
+
unknown:
|
7
|
+
id: 2
|
8
|
+
credit_limit: 50
|
9
|
+
|
10
|
+
rails_core_account:
|
11
|
+
id: 3
|
12
|
+
firm_id: 6
|
13
|
+
credit_limit: 50
|
14
|
+
|
15
|
+
last_account:
|
16
|
+
id: 4
|
17
|
+
firm_id: 2
|
18
|
+
credit_limit: 60
|
19
|
+
|
20
|
+
rails_core_account_2:
|
21
|
+
id: 5
|
22
|
+
firm_id: 6
|
23
|
+
credit_limit: 55
|
24
|
+
|
25
|
+
odegy_account:
|
26
|
+
id: 6
|
27
|
+
firm_id: 9
|
28
|
+
credit_limit: 53
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,107 @@
|
|
1
|
+
class Author < ActiveRecord::Base
|
2
|
+
has_many :posts
|
3
|
+
has_many :posts_with_comments, :include => :comments, :class_name => "Post"
|
4
|
+
has_many :posts_with_categories, :include => :categories, :class_name => "Post"
|
5
|
+
has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :order => "posts.id", :class_name => "Post"
|
6
|
+
has_many :posts_with_extension, :class_name => "Post" do #, :extend => ProxyTestExtension
|
7
|
+
def testing_proxy_owner
|
8
|
+
proxy_owner
|
9
|
+
end
|
10
|
+
def testing_proxy_reflection
|
11
|
+
proxy_reflection
|
12
|
+
end
|
13
|
+
def testing_proxy_target
|
14
|
+
proxy_target
|
15
|
+
end
|
16
|
+
end
|
17
|
+
has_many :comments, :through => :posts
|
18
|
+
has_many :comments_desc, :through => :posts, :source => :comments, :order => 'comments.id DESC'
|
19
|
+
has_many :limited_comments, :through => :posts, :source => :comments, :limit => 1
|
20
|
+
has_many :funky_comments, :through => :posts, :source => :comments
|
21
|
+
|
22
|
+
has_many :special_posts
|
23
|
+
has_many :special_post_comments, :through => :special_posts, :source => :comments
|
24
|
+
|
25
|
+
has_many :special_nonexistant_posts, :class_name => "SpecialPost", :conditions => "posts.body = 'nonexistant'"
|
26
|
+
has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => "comments.post_id = 0"
|
27
|
+
has_many :nonexistant_comments, :through => :posts
|
28
|
+
|
29
|
+
has_many :hello_posts, :class_name => "Post", :conditions => "posts.body = 'hello'"
|
30
|
+
has_many :hello_post_comments, :through => :hello_posts, :source => :comments
|
31
|
+
has_many :posts_with_no_comments, :class_name => 'Post', :conditions => 'comments.id is null', :include => :comments
|
32
|
+
|
33
|
+
has_many :other_posts, :class_name => "Post"
|
34
|
+
has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding,
|
35
|
+
:after_add => :log_after_adding,
|
36
|
+
:before_remove => :log_before_removing,
|
37
|
+
:after_remove => :log_after_removing
|
38
|
+
has_many :posts_with_proc_callbacks, :class_name => "Post",
|
39
|
+
:before_add => Proc.new {|o, r| o.post_log << "before_adding#{r.id || '<new>'}"},
|
40
|
+
:after_add => Proc.new {|o, r| o.post_log << "after_adding#{r.id || '<new>'}"},
|
41
|
+
:before_remove => Proc.new {|o, r| o.post_log << "before_removing#{r.id}"},
|
42
|
+
:after_remove => Proc.new {|o, r| o.post_log << "after_removing#{r.id}"}
|
43
|
+
has_many :posts_with_multiple_callbacks, :class_name => "Post",
|
44
|
+
:before_add => [:log_before_adding, Proc.new {|o, r| o.post_log << "before_adding_proc#{r.id || '<new>'}"}],
|
45
|
+
:after_add => [:log_after_adding, Proc.new {|o, r| o.post_log << "after_adding_proc#{r.id || '<new>'}"}]
|
46
|
+
has_many :unchangable_posts, :class_name => "Post", :before_add => :raise_exception, :after_add => :log_after_adding
|
47
|
+
|
48
|
+
has_many :categorizations
|
49
|
+
has_many :categories, :through => :categorizations
|
50
|
+
|
51
|
+
has_many :categories_like_general, :through => :categorizations, :source => :category, :class_name => 'Category', :conditions => { :name => 'General' }
|
52
|
+
|
53
|
+
has_many :categorized_posts, :through => :categorizations, :source => :post
|
54
|
+
has_many :unique_categorized_posts, :through => :categorizations, :source => :post, :uniq => true
|
55
|
+
|
56
|
+
has_many :nothings, :through => :kateggorisatons, :class_name => 'Category'
|
57
|
+
|
58
|
+
has_many :author_favorites
|
59
|
+
has_many :favorite_authors, :through => :author_favorites, :order => 'name'
|
60
|
+
|
61
|
+
has_many :tagging, :through => :posts # through polymorphic has_one
|
62
|
+
has_many :taggings, :through => :posts, :source => :taggings # through polymorphic has_many
|
63
|
+
has_many :tags, :through => :posts # through has_many :through
|
64
|
+
has_many :post_categories, :through => :posts, :source => :categories
|
65
|
+
|
66
|
+
belongs_to :author_address
|
67
|
+
|
68
|
+
attr_accessor :post_log
|
69
|
+
|
70
|
+
def after_initialize
|
71
|
+
@post_log = []
|
72
|
+
end
|
73
|
+
|
74
|
+
def label
|
75
|
+
"#{id}-#{name}"
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
def log_before_adding(object)
|
80
|
+
@post_log << "before_adding#{object.id || '<new>'}"
|
81
|
+
end
|
82
|
+
|
83
|
+
def log_after_adding(object)
|
84
|
+
@post_log << "after_adding#{object.id}"
|
85
|
+
end
|
86
|
+
|
87
|
+
def log_before_removing(object)
|
88
|
+
@post_log << "before_removing#{object.id}"
|
89
|
+
end
|
90
|
+
|
91
|
+
def log_after_removing(object)
|
92
|
+
@post_log << "after_removing#{object.id}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def raise_exception(object)
|
96
|
+
raise Exception.new("You can't add a post")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class AuthorAddress < ActiveRecord::Base
|
101
|
+
has_one :author
|
102
|
+
end
|
103
|
+
|
104
|
+
class AuthorFavorite < ActiveRecord::Base
|
105
|
+
belongs_to :author
|
106
|
+
belongs_to :favorite_author, :class_name => "Author", :foreign_key => 'favorite_author_id'
|
107
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
1b => 1
|
@@ -0,0 +1 @@
|
|
1
|
+
a b => 1
|
@@ -0,0 +1 @@
|
|
1
|
+
a =>
|
@@ -0,0 +1,132 @@
|
|
1
|
+
flowers:
|
2
|
+
id: 1
|
3
|
+
data: !binary | /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAA0JCQoKCg4LCw4UDQsNFBcRDg4R
|
4
|
+
FxsVFRUVFRsbFRcXFxcVGxoeICEgHhonJyoqJyc1NTU1NTY2NjY2NjY2Njb/
|
5
|
+
2wBDAQ4NDRERERcRERcXExQTFx0ZGhoZHSYdHR4dHSYsJCAgICAkLCgrJiYm
|
6
|
+
KygvLywsLy82NjY2NjY2NjY2NjY2Njb/wAARCACvAIMDAREAAhEBAxEB/8QA
|
7
|
+
GwAAAgMBAQEAAAAAAAAAAAAABAUAAwYCAQf/xABAEAACAQMCBAMFBwMBBQkA
|
8
|
+
AAABAgMABBESIQUTMUEiUWEUMnGBkQYjQlKxwdEzYqGSFSRD4fAlNUVyc4Ki
|
9
|
+
svH/xAAZAQADAQ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
2
|
+
category_id: 1
|
3
|
+
post_id: 1
|
4
|
+
|
5
|
+
technology_welcome:
|
6
|
+
category_id: 2
|
7
|
+
post_id: 1
|
8
|
+
|
9
|
+
general_thinking:
|
10
|
+
category_id: 1
|
11
|
+
post_id: 2
|
12
|
+
|
13
|
+
general_sti_habtm:
|
14
|
+
category_id: 1
|
15
|
+
post_id: 6
|
16
|
+
|
17
|
+
sti_test_sti_habtm:
|
18
|
+
category_id: 3
|
19
|
+
post_id: 6
|
20
|
+
|
21
|
+
general_hello:
|
22
|
+
category_id: 1
|
23
|
+
post_id: 4
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Category < ActiveRecord::Base
|
2
|
+
has_and_belongs_to_many :posts
|
3
|
+
has_and_belongs_to_many :special_posts, :class_name => "Post"
|
4
|
+
has_and_belongs_to_many :other_posts, :class_name => "Post"
|
5
|
+
|
6
|
+
has_and_belongs_to_many(:select_testing_posts,
|
7
|
+
:class_name => 'Post',
|
8
|
+
:foreign_key => 'category_id',
|
9
|
+
:association_foreign_key => 'post_id',
|
10
|
+
:select => 'posts.*, 1 as correctness_marker')
|
11
|
+
|
12
|
+
def self.what_are_you
|
13
|
+
'a category...'
|
14
|
+
end
|
15
|
+
|
16
|
+
has_many :categorizations
|
17
|
+
has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
|
18
|
+
end
|
19
|
+
|
20
|
+
class SpecialCategory < Category
|
21
|
+
|
22
|
+
def self.what_are_you
|
23
|
+
'a special category...'
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Comment < ActiveRecord::Base
|
2
|
+
belongs_to :post
|
3
|
+
|
4
|
+
def self.what_are_you
|
5
|
+
'a comment...'
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.search_by_type(q)
|
9
|
+
self.find(:all, :conditions => ["#{QUOTED_TYPE} = ?", q])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class SpecialComment < Comment
|
14
|
+
def self.what_are_you
|
15
|
+
'a special comment...'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class VerySpecialComment < Comment
|
20
|
+
def self.what_are_you
|
21
|
+
'a very special comment...'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
greetings:
|
2
|
+
id: 1
|
3
|
+
post_id: 1
|
4
|
+
body: Thank you for the welcome
|
5
|
+
type: Comment
|
6
|
+
|
7
|
+
more_greetings:
|
8
|
+
id: 2
|
9
|
+
post_id: 1
|
10
|
+
body: Thank you again for the welcome
|
11
|
+
type: Comment
|
12
|
+
|
13
|
+
does_it_hurt:
|
14
|
+
id: 3
|
15
|
+
post_id: 2
|
16
|
+
body: Don't think too hard
|
17
|
+
type: SpecialComment
|
18
|
+
|
19
|
+
eager_sti_on_associations_vs_comment:
|
20
|
+
id: 5
|
21
|
+
post_id: 4
|
22
|
+
body: Very Special type
|
23
|
+
type: VerySpecialComment
|
24
|
+
|
25
|
+
eager_sti_on_associations_s_comment1:
|
26
|
+
id: 6
|
27
|
+
post_id: 4
|
28
|
+
body: Special type
|
29
|
+
type: SpecialComment
|
30
|
+
|
31
|
+
eager_sti_on_associations_s_comment2:
|
32
|
+
id: 7
|
33
|
+
post_id: 4
|
34
|
+
body: Special type 2
|
35
|
+
type: SpecialComment
|
36
|
+
|
37
|
+
eager_sti_on_associations_comment:
|
38
|
+
id: 8
|
39
|
+
post_id: 4
|
40
|
+
body: Normal type
|
41
|
+
type: Comment
|
42
|
+
|
43
|
+
check_eager_sti_on_associations:
|
44
|
+
id: 9
|
45
|
+
post_id: 5
|
46
|
+
body: Normal type
|
47
|
+
type: Comment
|
48
|
+
|
49
|
+
check_eager_sti_on_associations2:
|
50
|
+
id: 10
|
51
|
+
post_id: 5
|
52
|
+
body: Special Type
|
53
|
+
type: SpecialComment
|
54
|
+
|
55
|
+
eager_other_comment1:
|
56
|
+
id: 11
|
57
|
+
post_id: 7
|
58
|
+
body: go crazy
|
59
|
+
type: SpecialComment
|
@@ -0,0 +1,55 @@
|
|
1
|
+
first_client:
|
2
|
+
id: 2
|
3
|
+
type: Client
|
4
|
+
firm_id: 1
|
5
|
+
client_of: 2
|
6
|
+
name: Summit
|
7
|
+
ruby_type: Client
|
8
|
+
|
9
|
+
first_firm:
|
10
|
+
id: 1
|
11
|
+
type: Firm
|
12
|
+
name: 37signals
|
13
|
+
ruby_type: Firm
|
14
|
+
|
15
|
+
second_client:
|
16
|
+
id: 3
|
17
|
+
type: Client
|
18
|
+
firm_id: 1
|
19
|
+
client_of: 1
|
20
|
+
name: Microsoft
|
21
|
+
ruby_type: Client
|
22
|
+
|
23
|
+
another_firm:
|
24
|
+
id: 4
|
25
|
+
type: Firm
|
26
|
+
name: Flamboyant Software
|
27
|
+
ruby_type: Firm
|
28
|
+
|
29
|
+
another_client:
|
30
|
+
id: 5
|
31
|
+
type: Client
|
32
|
+
firm_id: 4
|
33
|
+
client_of: 4
|
34
|
+
name: Ex Nihilo
|
35
|
+
ruby_type: Client
|
36
|
+
|
37
|
+
rails_core:
|
38
|
+
id: 6
|
39
|
+
name: RailsCore
|
40
|
+
type: DependentFirm
|
41
|
+
|
42
|
+
leetsoft:
|
43
|
+
id: 7
|
44
|
+
name: Leetsoft
|
45
|
+
client_of: 6
|
46
|
+
|
47
|
+
jadedpixel:
|
48
|
+
id: 8
|
49
|
+
name: Jadedpixel
|
50
|
+
client_of: 6
|
51
|
+
|
52
|
+
odegy:
|
53
|
+
id: 9
|
54
|
+
name: Odegy
|
55
|
+
type: ExclusivelyDependentFirm
|