activerecord 2.3.18 → 3.2.22
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +1014 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +222 -0
- data/examples/performance.rb +100 -126
- data/examples/simple.rb +14 -0
- data/lib/active_record/aggregations.rb +93 -99
- data/lib/active_record/associations/alias_tracker.rb +76 -0
- data/lib/active_record/associations/association.rb +247 -0
- data/lib/active_record/associations/association_scope.rb +134 -0
- data/lib/active_record/associations/belongs_to_association.rb +54 -61
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +17 -59
- data/lib/active_record/associations/builder/association.rb +55 -0
- data/lib/active_record/associations/builder/belongs_to.rb +88 -0
- data/lib/active_record/associations/builder/collection_association.rb +75 -0
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +57 -0
- data/lib/active_record/associations/builder/has_many.rb +71 -0
- data/lib/active_record/associations/builder/has_one.rb +62 -0
- data/lib/active_record/associations/builder/singular_association.rb +32 -0
- data/lib/active_record/associations/collection_association.rb +580 -0
- data/lib/active_record/associations/collection_proxy.rb +133 -0
- data/lib/active_record/associations/has_and_belongs_to_many_association.rb +39 -119
- data/lib/active_record/associations/has_many_association.rb +60 -79
- data/lib/active_record/associations/has_many_through_association.rb +127 -206
- data/lib/active_record/associations/has_one_association.rb +55 -114
- data/lib/active_record/associations/has_one_through_association.rb +25 -26
- data/lib/active_record/associations/join_dependency/join_association.rb +159 -0
- data/lib/active_record/associations/join_dependency/join_base.rb +24 -0
- data/lib/active_record/associations/join_dependency/join_part.rb +78 -0
- data/lib/active_record/associations/join_dependency.rb +214 -0
- data/lib/active_record/associations/join_helper.rb +55 -0
- data/lib/active_record/associations/preloader/association.rb +125 -0
- data/lib/active_record/associations/preloader/belongs_to.rb +17 -0
- data/lib/active_record/associations/preloader/collection_association.rb +24 -0
- data/lib/active_record/associations/preloader/has_and_belongs_to_many.rb +60 -0
- data/lib/active_record/associations/preloader/has_many.rb +17 -0
- data/lib/active_record/associations/preloader/has_many_through.rb +15 -0
- data/lib/active_record/associations/preloader/has_one.rb +23 -0
- data/lib/active_record/associations/preloader/has_one_through.rb +9 -0
- data/lib/active_record/associations/preloader/singular_association.rb +21 -0
- data/lib/active_record/associations/preloader/through_association.rb +67 -0
- data/lib/active_record/associations/preloader.rb +181 -0
- data/lib/active_record/associations/singular_association.rb +64 -0
- data/lib/active_record/associations/through_association.rb +87 -0
- data/lib/active_record/associations.rb +693 -1337
- data/lib/active_record/attribute_assignment.rb +221 -0
- data/lib/active_record/attribute_methods/before_type_cast.rb +31 -0
- data/lib/active_record/attribute_methods/deprecated_underscore_read.rb +32 -0
- data/lib/active_record/attribute_methods/dirty.rb +111 -0
- data/lib/active_record/attribute_methods/primary_key.rb +114 -0
- data/lib/active_record/attribute_methods/query.rb +39 -0
- data/lib/active_record/attribute_methods/read.rb +136 -0
- data/lib/active_record/attribute_methods/serialization.rb +120 -0
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +65 -0
- data/lib/active_record/attribute_methods/write.rb +70 -0
- data/lib/active_record/attribute_methods.rb +211 -339
- data/lib/active_record/autosave_association.rb +179 -149
- data/lib/active_record/base.rb +401 -2907
- data/lib/active_record/callbacks.rb +91 -176
- data/lib/active_record/coders/yaml_column.rb +41 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +236 -119
- data/lib/active_record/connection_adapters/abstract/connection_specification.rb +110 -58
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +12 -11
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +175 -74
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +31 -35
- data/lib/active_record/connection_adapters/abstract/quoting.rb +71 -21
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +81 -311
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +194 -78
- data/lib/active_record/connection_adapters/abstract_adapter.rb +130 -83
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +676 -0
- data/lib/active_record/connection_adapters/column.rb +296 -0
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +280 -0
- data/lib/active_record/connection_adapters/mysql_adapter.rb +272 -493
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +650 -405
- data/lib/active_record/connection_adapters/schema_cache.rb +69 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +30 -9
- data/lib/active_record/connection_adapters/sqlite_adapter.rb +276 -147
- data/lib/active_record/connection_adapters/statement_pool.rb +40 -0
- data/lib/active_record/counter_cache.rb +123 -0
- data/lib/active_record/dynamic_finder_match.rb +41 -14
- data/lib/active_record/dynamic_matchers.rb +84 -0
- data/lib/active_record/dynamic_scope_match.rb +13 -15
- data/lib/active_record/errors.rb +195 -0
- data/lib/active_record/explain.rb +86 -0
- data/lib/active_record/explain_subscriber.rb +25 -0
- data/lib/active_record/fixtures/file.rb +65 -0
- data/lib/active_record/fixtures.rb +695 -770
- data/lib/active_record/identity_map.rb +162 -0
- data/lib/active_record/inheritance.rb +174 -0
- data/lib/active_record/integration.rb +60 -0
- data/lib/active_record/locale/en.yml +9 -27
- data/lib/active_record/locking/optimistic.rb +76 -73
- data/lib/active_record/locking/pessimistic.rb +32 -10
- data/lib/active_record/log_subscriber.rb +72 -0
- data/lib/active_record/migration/command_recorder.rb +105 -0
- data/lib/active_record/migration.rb +415 -205
- data/lib/active_record/model_schema.rb +368 -0
- data/lib/active_record/nested_attributes.rb +153 -63
- data/lib/active_record/observer.rb +27 -103
- data/lib/active_record/persistence.rb +376 -0
- data/lib/active_record/query_cache.rb +49 -8
- data/lib/active_record/querying.rb +58 -0
- data/lib/active_record/railtie.rb +131 -0
- data/lib/active_record/railties/console_sandbox.rb +6 -0
- data/lib/active_record/railties/controller_runtime.rb +49 -0
- data/lib/active_record/railties/databases.rake +659 -0
- data/lib/active_record/railties/jdbcmysql_error.rb +16 -0
- data/lib/active_record/readonly_attributes.rb +26 -0
- data/lib/active_record/reflection.rb +269 -120
- data/lib/active_record/relation/batches.rb +90 -0
- data/lib/active_record/relation/calculations.rb +372 -0
- data/lib/active_record/relation/delegation.rb +49 -0
- data/lib/active_record/relation/finder_methods.rb +402 -0
- data/lib/active_record/relation/predicate_builder.rb +63 -0
- data/lib/active_record/relation/query_methods.rb +417 -0
- data/lib/active_record/relation/spawn_methods.rb +180 -0
- data/lib/active_record/relation.rb +537 -0
- data/lib/active_record/result.rb +40 -0
- data/lib/active_record/sanitization.rb +194 -0
- data/lib/active_record/schema.rb +9 -6
- data/lib/active_record/schema_dumper.rb +55 -32
- data/lib/active_record/scoping/default.rb +142 -0
- data/lib/active_record/scoping/named.rb +200 -0
- data/lib/active_record/scoping.rb +152 -0
- data/lib/active_record/serialization.rb +8 -91
- data/lib/active_record/serializers/xml_serializer.rb +43 -197
- data/lib/active_record/session_store.rb +129 -103
- data/lib/active_record/store.rb +52 -0
- data/lib/active_record/test_case.rb +30 -23
- data/lib/active_record/timestamp.rb +95 -52
- data/lib/active_record/transactions.rb +212 -66
- data/lib/active_record/translation.rb +22 -0
- data/lib/active_record/validations/associated.rb +43 -0
- data/lib/active_record/validations/uniqueness.rb +180 -0
- data/lib/active_record/validations.rb +43 -1106
- data/lib/active_record/version.rb +5 -4
- data/lib/active_record.rb +121 -48
- data/lib/rails/generators/active_record/migration/migration_generator.rb +25 -0
- data/lib/rails/generators/active_record/migration/templates/migration.rb +34 -0
- data/lib/rails/generators/active_record/migration.rb +15 -0
- data/lib/rails/generators/active_record/model/model_generator.rb +47 -0
- data/lib/rails/generators/active_record/model/templates/migration.rb +15 -0
- data/lib/rails/generators/active_record/model/templates/model.rb +12 -0
- data/lib/rails/generators/active_record/model/templates/module.rb +7 -0
- data/lib/rails/generators/active_record/observer/observer_generator.rb +15 -0
- data/lib/rails/generators/active_record/observer/templates/observer.rb +4 -0
- data/lib/rails/generators/active_record/session_migration/session_migration_generator.rb +25 -0
- data/lib/rails/generators/active_record/session_migration/templates/migration.rb +12 -0
- data/lib/rails/generators/active_record.rb +25 -0
- metadata +187 -363
- data/CHANGELOG +0 -5904
- data/README +0 -351
- data/RUNNING_UNIT_TESTS +0 -36
- data/Rakefile +0 -268
- data/install.rb +0 -30
- data/lib/active_record/association_preload.rb +0 -406
- data/lib/active_record/associations/association_collection.rb +0 -533
- data/lib/active_record/associations/association_proxy.rb +0 -288
- data/lib/active_record/batches.rb +0 -85
- data/lib/active_record/calculations.rb +0 -321
- data/lib/active_record/dirty.rb +0 -183
- data/lib/active_record/named_scope.rb +0 -197
- data/lib/active_record/serializers/json_serializer.rb +0 -91
- data/lib/activerecord.rb +0 -2
- data/test/assets/example.log +0 -1
- data/test/assets/flowers.jpg +0 -0
- data/test/cases/aaa_create_tables_test.rb +0 -24
- data/test/cases/active_schema_test_mysql.rb +0 -122
- data/test/cases/active_schema_test_postgresql.rb +0 -24
- data/test/cases/adapter_test.rb +0 -144
- data/test/cases/aggregations_test.rb +0 -167
- data/test/cases/ar_schema_test.rb +0 -32
- data/test/cases/associations/belongs_to_associations_test.rb +0 -438
- data/test/cases/associations/callbacks_test.rb +0 -161
- data/test/cases/associations/cascaded_eager_loading_test.rb +0 -131
- data/test/cases/associations/eager_load_includes_full_sti_class_test.rb +0 -36
- data/test/cases/associations/eager_load_nested_include_test.rb +0 -131
- data/test/cases/associations/eager_load_nested_polymorphic_include.rb +0 -19
- data/test/cases/associations/eager_singularization_test.rb +0 -145
- data/test/cases/associations/eager_test.rb +0 -852
- data/test/cases/associations/extension_test.rb +0 -62
- data/test/cases/associations/habtm_join_table_test.rb +0 -56
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +0 -827
- data/test/cases/associations/has_many_associations_test.rb +0 -1273
- data/test/cases/associations/has_many_through_associations_test.rb +0 -360
- data/test/cases/associations/has_one_associations_test.rb +0 -330
- data/test/cases/associations/has_one_through_associations_test.rb +0 -209
- data/test/cases/associations/inner_join_association_test.rb +0 -93
- data/test/cases/associations/inverse_associations_test.rb +0 -566
- data/test/cases/associations/join_model_test.rb +0 -712
- data/test/cases/associations_test.rb +0 -282
- data/test/cases/attribute_methods_test.rb +0 -305
- data/test/cases/autosave_association_test.rb +0 -1218
- data/test/cases/base_test.rb +0 -2166
- data/test/cases/batches_test.rb +0 -81
- data/test/cases/binary_test.rb +0 -30
- data/test/cases/calculations_test.rb +0 -360
- data/test/cases/callbacks_observers_test.rb +0 -38
- data/test/cases/callbacks_test.rb +0 -438
- data/test/cases/class_inheritable_attributes_test.rb +0 -32
- data/test/cases/column_alias_test.rb +0 -17
- data/test/cases/column_definition_test.rb +0 -70
- data/test/cases/connection_pool_test.rb +0 -25
- data/test/cases/connection_test_firebird.rb +0 -8
- data/test/cases/connection_test_mysql.rb +0 -65
- data/test/cases/copy_table_test_sqlite.rb +0 -80
- data/test/cases/counter_cache_test.rb +0 -84
- data/test/cases/database_statements_test.rb +0 -12
- data/test/cases/datatype_test_postgresql.rb +0 -204
- data/test/cases/date_time_test.rb +0 -37
- data/test/cases/default_test_firebird.rb +0 -16
- data/test/cases/defaults_test.rb +0 -111
- data/test/cases/deprecated_finder_test.rb +0 -30
- data/test/cases/dirty_test.rb +0 -316
- data/test/cases/finder_respond_to_test.rb +0 -76
- data/test/cases/finder_test.rb +0 -1098
- data/test/cases/fixtures_test.rb +0 -661
- data/test/cases/helper.rb +0 -68
- data/test/cases/i18n_test.rb +0 -46
- data/test/cases/inheritance_test.rb +0 -262
- data/test/cases/invalid_date_test.rb +0 -24
- data/test/cases/json_serialization_test.rb +0 -219
- data/test/cases/lifecycle_test.rb +0 -193
- data/test/cases/locking_test.rb +0 -350
- data/test/cases/method_scoping_test.rb +0 -704
- data/test/cases/migration_test.rb +0 -1649
- data/test/cases/migration_test_firebird.rb +0 -124
- data/test/cases/mixin_test.rb +0 -96
- data/test/cases/modules_test.rb +0 -109
- data/test/cases/multiple_db_test.rb +0 -85
- data/test/cases/named_scope_test.rb +0 -372
- data/test/cases/nested_attributes_test.rb +0 -840
- data/test/cases/pk_test.rb +0 -119
- data/test/cases/pooled_connections_test.rb +0 -103
- data/test/cases/query_cache_test.rb +0 -129
- data/test/cases/readonly_test.rb +0 -107
- data/test/cases/reflection_test.rb +0 -234
- data/test/cases/reload_models_test.rb +0 -22
- data/test/cases/repair_helper.rb +0 -50
- data/test/cases/reserved_word_test_mysql.rb +0 -176
- data/test/cases/sanitize_test.rb +0 -25
- data/test/cases/schema_authorization_test_postgresql.rb +0 -75
- data/test/cases/schema_dumper_test.rb +0 -211
- data/test/cases/schema_test_postgresql.rb +0 -178
- data/test/cases/serialization_test.rb +0 -47
- data/test/cases/sp_test_mysql.rb +0 -16
- data/test/cases/synonym_test_oracle.rb +0 -17
- data/test/cases/timestamp_test.rb +0 -75
- data/test/cases/transactions_test.rb +0 -543
- data/test/cases/unconnected_test.rb +0 -32
- data/test/cases/validations_i18n_test.rb +0 -925
- data/test/cases/validations_test.rb +0 -1684
- data/test/cases/xml_serialization_test.rb +0 -240
- data/test/cases/yaml_serialization_test.rb +0 -11
- data/test/config.rb +0 -5
- data/test/connections/jdbc_jdbcderby/connection.rb +0 -18
- data/test/connections/jdbc_jdbch2/connection.rb +0 -18
- data/test/connections/jdbc_jdbchsqldb/connection.rb +0 -18
- data/test/connections/jdbc_jdbcmysql/connection.rb +0 -26
- data/test/connections/jdbc_jdbcpostgresql/connection.rb +0 -26
- data/test/connections/jdbc_jdbcsqlite3/connection.rb +0 -25
- data/test/connections/native_db2/connection.rb +0 -25
- data/test/connections/native_firebird/connection.rb +0 -26
- data/test/connections/native_frontbase/connection.rb +0 -27
- data/test/connections/native_mysql/connection.rb +0 -25
- data/test/connections/native_openbase/connection.rb +0 -21
- data/test/connections/native_oracle/connection.rb +0 -27
- data/test/connections/native_postgresql/connection.rb +0 -21
- data/test/connections/native_sqlite/connection.rb +0 -25
- data/test/connections/native_sqlite3/connection.rb +0 -25
- data/test/connections/native_sqlite3/in_memory_connection.rb +0 -18
- data/test/connections/native_sybase/connection.rb +0 -23
- data/test/fixtures/accounts.yml +0 -29
- 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_addresses.yml +0 -5
- data/test/fixtures/author_favorites.yml +0 -4
- data/test/fixtures/authors.yml +0 -9
- data/test/fixtures/binaries.yml +0 -132
- data/test/fixtures/books.yml +0 -7
- data/test/fixtures/categories/special_categories.yml +0 -9
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +0 -4
- data/test/fixtures/categories.yml +0 -14
- data/test/fixtures/categories_ordered.yml +0 -7
- data/test/fixtures/categories_posts.yml +0 -23
- data/test/fixtures/categorizations.yml +0 -17
- data/test/fixtures/clubs.yml +0 -6
- data/test/fixtures/comments.yml +0 -59
- data/test/fixtures/companies.yml +0 -56
- data/test/fixtures/computers.yml +0 -4
- data/test/fixtures/courses.yml +0 -7
- data/test/fixtures/customers.yml +0 -26
- data/test/fixtures/developers.yml +0 -21
- data/test/fixtures/developers_projects.yml +0 -17
- data/test/fixtures/edges.yml +0 -6
- data/test/fixtures/entrants.yml +0 -14
- data/test/fixtures/faces.yml +0 -11
- data/test/fixtures/fk_test_has_fk.yml +0 -3
- data/test/fixtures/fk_test_has_pk.yml +0 -2
- data/test/fixtures/funny_jokes.yml +0 -10
- data/test/fixtures/interests.yml +0 -33
- data/test/fixtures/items.yml +0 -4
- data/test/fixtures/jobs.yml +0 -7
- data/test/fixtures/legacy_things.yml +0 -3
- data/test/fixtures/mateys.yml +0 -4
- data/test/fixtures/member_types.yml +0 -6
- data/test/fixtures/members.yml +0 -6
- data/test/fixtures/memberships.yml +0 -20
- data/test/fixtures/men.yml +0 -5
- data/test/fixtures/minimalistics.yml +0 -2
- data/test/fixtures/mixed_case_monkeys.yml +0 -6
- data/test/fixtures/mixins.yml +0 -29
- data/test/fixtures/movies.yml +0 -7
- data/test/fixtures/naked/csv/accounts.csv +0 -1
- data/test/fixtures/naked/yml/accounts.yml +0 -1
- data/test/fixtures/naked/yml/companies.yml +0 -1
- data/test/fixtures/naked/yml/courses.yml +0 -1
- data/test/fixtures/organizations.yml +0 -5
- data/test/fixtures/owners.yml +0 -7
- data/test/fixtures/parrots.yml +0 -27
- data/test/fixtures/parrots_pirates.yml +0 -7
- data/test/fixtures/people.yml +0 -15
- data/test/fixtures/pets.yml +0 -14
- data/test/fixtures/pirates.yml +0 -9
- data/test/fixtures/polymorphic_designs.yml +0 -19
- data/test/fixtures/polymorphic_prices.yml +0 -19
- data/test/fixtures/posts.yml +0 -52
- data/test/fixtures/price_estimates.yml +0 -7
- data/test/fixtures/projects.yml +0 -7
- data/test/fixtures/readers.yml +0 -9
- data/test/fixtures/references.yml +0 -17
- data/test/fixtures/reserved_words/distinct.yml +0 -5
- data/test/fixtures/reserved_words/distincts_selects.yml +0 -11
- data/test/fixtures/reserved_words/group.yml +0 -14
- data/test/fixtures/reserved_words/select.yml +0 -8
- data/test/fixtures/reserved_words/values.yml +0 -7
- data/test/fixtures/ships.yml +0 -5
- data/test/fixtures/sponsors.yml +0 -9
- data/test/fixtures/subscribers.yml +0 -7
- data/test/fixtures/subscriptions.yml +0 -12
- data/test/fixtures/taggings.yml +0 -28
- data/test/fixtures/tags.yml +0 -7
- data/test/fixtures/tasks.yml +0 -7
- data/test/fixtures/tees.yml +0 -4
- data/test/fixtures/ties.yml +0 -4
- data/test/fixtures/topics.yml +0 -42
- data/test/fixtures/toys.yml +0 -4
- data/test/fixtures/treasures.yml +0 -10
- data/test/fixtures/vertices.yml +0 -4
- data/test/fixtures/warehouse-things.yml +0 -3
- data/test/fixtures/zines.yml +0 -5
- data/test/migrations/broken/100_migration_that_raises_exception.rb +0 -10
- data/test/migrations/decimal/1_give_me_big_numbers.rb +0 -15
- data/test/migrations/duplicate/1_people_have_last_names.rb +0 -9
- data/test/migrations/duplicate/2_we_need_reminders.rb +0 -12
- data/test/migrations/duplicate/3_foo.rb +0 -7
- data/test/migrations/duplicate/3_innocent_jointable.rb +0 -12
- data/test/migrations/duplicate_names/20080507052938_chunky.rb +0 -7
- data/test/migrations/duplicate_names/20080507053028_chunky.rb +0 -7
- data/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +0 -12
- data/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +0 -9
- data/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +0 -12
- data/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +0 -9
- data/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +0 -8
- data/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +0 -12
- data/test/migrations/missing/1000_people_have_middle_names.rb +0 -9
- data/test/migrations/missing/1_people_have_last_names.rb +0 -9
- data/test/migrations/missing/3_we_need_reminders.rb +0 -12
- data/test/migrations/missing/4_innocent_jointable.rb +0 -12
- data/test/migrations/valid/1_people_have_last_names.rb +0 -9
- data/test/migrations/valid/2_we_need_reminders.rb +0 -12
- data/test/migrations/valid/3_innocent_jointable.rb +0 -12
- data/test/models/author.rb +0 -151
- data/test/models/auto_id.rb +0 -4
- data/test/models/binary.rb +0 -2
- data/test/models/bird.rb +0 -9
- data/test/models/book.rb +0 -4
- data/test/models/categorization.rb +0 -5
- data/test/models/category.rb +0 -34
- data/test/models/citation.rb +0 -6
- data/test/models/club.rb +0 -13
- data/test/models/column_name.rb +0 -3
- data/test/models/comment.rb +0 -29
- data/test/models/company.rb +0 -173
- data/test/models/company_in_module.rb +0 -78
- data/test/models/computer.rb +0 -3
- data/test/models/contact.rb +0 -16
- data/test/models/contract.rb +0 -5
- data/test/models/course.rb +0 -3
- data/test/models/customer.rb +0 -73
- data/test/models/default.rb +0 -2
- data/test/models/developer.rb +0 -101
- data/test/models/edge.rb +0 -5
- data/test/models/entrant.rb +0 -3
- data/test/models/essay.rb +0 -3
- data/test/models/event.rb +0 -3
- data/test/models/event_author.rb +0 -8
- data/test/models/face.rb +0 -7
- data/test/models/guid.rb +0 -2
- data/test/models/interest.rb +0 -5
- data/test/models/invoice.rb +0 -4
- data/test/models/item.rb +0 -7
- data/test/models/job.rb +0 -5
- data/test/models/joke.rb +0 -3
- data/test/models/keyboard.rb +0 -3
- data/test/models/legacy_thing.rb +0 -3
- data/test/models/line_item.rb +0 -3
- data/test/models/man.rb +0 -9
- data/test/models/matey.rb +0 -4
- data/test/models/member.rb +0 -12
- data/test/models/member_detail.rb +0 -5
- data/test/models/member_type.rb +0 -3
- data/test/models/membership.rb +0 -9
- data/test/models/minimalistic.rb +0 -2
- data/test/models/mixed_case_monkey.rb +0 -3
- data/test/models/movie.rb +0 -5
- data/test/models/order.rb +0 -4
- data/test/models/organization.rb +0 -6
- data/test/models/owner.rb +0 -5
- data/test/models/parrot.rb +0 -22
- data/test/models/person.rb +0 -16
- data/test/models/pet.rb +0 -5
- data/test/models/pirate.rb +0 -80
- data/test/models/polymorphic_design.rb +0 -3
- data/test/models/polymorphic_price.rb +0 -3
- data/test/models/post.rb +0 -102
- data/test/models/price_estimate.rb +0 -3
- data/test/models/project.rb +0 -30
- data/test/models/reader.rb +0 -4
- data/test/models/reference.rb +0 -4
- data/test/models/reply.rb +0 -46
- data/test/models/ship.rb +0 -19
- data/test/models/ship_part.rb +0 -7
- data/test/models/sponsor.rb +0 -4
- data/test/models/subject.rb +0 -4
- data/test/models/subscriber.rb +0 -8
- data/test/models/subscription.rb +0 -4
- data/test/models/tag.rb +0 -7
- data/test/models/tagging.rb +0 -10
- data/test/models/task.rb +0 -3
- data/test/models/tee.rb +0 -4
- data/test/models/tie.rb +0 -4
- data/test/models/topic.rb +0 -80
- data/test/models/toy.rb +0 -6
- data/test/models/treasure.rb +0 -8
- data/test/models/vertex.rb +0 -9
- data/test/models/warehouse_thing.rb +0 -5
- data/test/models/zine.rb +0 -3
- data/test/schema/mysql_specific_schema.rb +0 -31
- data/test/schema/postgresql_specific_schema.rb +0 -114
- data/test/schema/schema.rb +0 -550
- data/test/schema/schema2.rb +0 -6
- data/test/schema/sqlite_specific_schema.rb +0 -25
data/CHANGELOG.md
ADDED
@@ -0,0 +1,1014 @@
|
|
1
|
+
## Rails 3.2.22 (Jun 16, 2015) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 3.2.19 (Jul 2, 2014) ##
|
7
|
+
|
8
|
+
* Fix SQL Injection Vulnerability in 'bitstring' quoting.
|
9
|
+
|
10
|
+
Fixes CVE-2014-3482.
|
11
|
+
|
12
|
+
*Rafael Mendonça França*
|
13
|
+
|
14
|
+
|
15
|
+
## Rails 3.2.18 (May 6, 2014) ##
|
16
|
+
|
17
|
+
* No changes.
|
18
|
+
|
19
|
+
|
20
|
+
## Rails 3.2.17 (Feb 18, 2014) ##
|
21
|
+
|
22
|
+
* No changes.
|
23
|
+
|
24
|
+
|
25
|
+
## Rails 3.2.16 (Dec 3, 2013) ##
|
26
|
+
|
27
|
+
* No changes.
|
28
|
+
|
29
|
+
|
30
|
+
## Rails 3.2.15 (Oct 16, 2013) ##
|
31
|
+
|
32
|
+
* When calling the method .find_or_initialize_by_* from a collection_proxy
|
33
|
+
it should set the inverse_of relation even when the entry was found on the db.
|
34
|
+
|
35
|
+
*arthurnn*
|
36
|
+
|
37
|
+
* Callbacks on has_many should access the in memory parent if a inverse_of is set.
|
38
|
+
|
39
|
+
*arthurnn*
|
40
|
+
|
41
|
+
* Fix `FinderMethods#last` unscoped primary key.
|
42
|
+
|
43
|
+
Fixes #11917.
|
44
|
+
|
45
|
+
*Eugene Kalenkovich*
|
46
|
+
|
47
|
+
* Load fixtures from linked folders.
|
48
|
+
|
49
|
+
*Kassio Borges*
|
50
|
+
|
51
|
+
* When using optimistic locking, `update` was not passing the column to `quote_value`
|
52
|
+
to allow the connection adapter to properly determine how to quote the value. This was
|
53
|
+
affecting certain databases that use specific colmn types.
|
54
|
+
|
55
|
+
Fixes: #6763
|
56
|
+
|
57
|
+
*Alfred Wong*
|
58
|
+
|
59
|
+
|
60
|
+
## Rails 3.2.14 (Jul 22, 2013) ##
|
61
|
+
|
62
|
+
* Fix merge error when Equality LHS is non-attribute.
|
63
|
+
Backport of #7380.
|
64
|
+
|
65
|
+
*Karmes Alexander*
|
66
|
+
|
67
|
+
* Do not re-create destroyed association when saving the parent object.
|
68
|
+
|
69
|
+
Fixes #11450.
|
70
|
+
|
71
|
+
*Paul Nikitochkin*
|
72
|
+
|
73
|
+
* Do not shallow the original exception in `exec_cache` on PostgreSQL adapter.
|
74
|
+
|
75
|
+
Fixes #11260.
|
76
|
+
|
77
|
+
*Rafael Mendonça França*
|
78
|
+
|
79
|
+
* Fix `ActiveRecord::Store` incorrectly tracking changes of its attributes.
|
80
|
+
Fixes #10373.
|
81
|
+
|
82
|
+
*Janko Marohnić*
|
83
|
+
|
84
|
+
* Fix a bug that prevented the use of the default STI inheritance column
|
85
|
+
(ActiveRecord::Base.inheritance_column = 'some_column'.)
|
86
|
+
|
87
|
+
*chapmajs + Takehiro Adachi*
|
88
|
+
|
89
|
+
* Fix mysql2 adapter raises the correct exception when executing a query on a
|
90
|
+
closed connection.
|
91
|
+
|
92
|
+
*Yves Senn*
|
93
|
+
|
94
|
+
* Fixes bug where `Company.new.contract_ids` would incorrectly load
|
95
|
+
all non-associated contracts.
|
96
|
+
|
97
|
+
Example:
|
98
|
+
|
99
|
+
company = Company.new # Company has many :contracts
|
100
|
+
|
101
|
+
# before
|
102
|
+
company.contract_ids # => SELECT ... WHERE `contracts`.`company_id` IS NULL
|
103
|
+
|
104
|
+
# after
|
105
|
+
company.contract_ids # => []
|
106
|
+
|
107
|
+
*Jared Armstrong*
|
108
|
+
|
109
|
+
* Fix the `:primary_key` option for `has_many` associations.
|
110
|
+
Fixes #10693.
|
111
|
+
|
112
|
+
*Yves Senn*
|
113
|
+
|
114
|
+
* fixes bug introduced by #3329. Now, when autosaving associations,
|
115
|
+
deletions happen before inserts and saves. This prevents a 'duplicate
|
116
|
+
unique value' database error that would occur if a record being created had
|
117
|
+
the same value on a unique indexed field as that of a record being destroyed.
|
118
|
+
|
119
|
+
Backport of #10417
|
120
|
+
|
121
|
+
*Johnny Holton*
|
122
|
+
|
123
|
+
* Fix that under some conditions, Active Record could produce invalid SQL of the sort:
|
124
|
+
"SELECT DISTINCT DISTINCT".
|
125
|
+
|
126
|
+
Backport of #6792.
|
127
|
+
|
128
|
+
*Ben Woosley*
|
129
|
+
|
130
|
+
* Require `ActiveRecord::Base` in railtie hooks for rake_tasks, console and runner to
|
131
|
+
avoid circular constant loading issues.
|
132
|
+
|
133
|
+
Backport #7695.
|
134
|
+
|
135
|
+
Fixes #7683 and #882
|
136
|
+
|
137
|
+
*Ben Holley*
|
138
|
+
|
139
|
+
* Maintain context for joins within ActiveRecord::Relation merges.
|
140
|
+
Backport #10164.
|
141
|
+
|
142
|
+
*Neeraj Singh + Andrew Horner*
|
143
|
+
|
144
|
+
* Make sure the `EXPLAIN` command is never triggered by a `select_db` call.
|
145
|
+
|
146
|
+
*Daniel Schierbeck*
|
147
|
+
|
148
|
+
* Revert changes on `pluck` that was ignoring the select clause when the relation already
|
149
|
+
has one. This caused a regression since it changed the behavior in a stable release.
|
150
|
+
|
151
|
+
Fixes #9777.
|
152
|
+
|
153
|
+
*Rafael Mendonça França*
|
154
|
+
|
155
|
+
* Confirm a record has not already been destroyed before decrementing counter cache.
|
156
|
+
|
157
|
+
*Ben Tucker*
|
158
|
+
|
159
|
+
* Default values for PostgreSQL bigint types now get parsed and dumped to the
|
160
|
+
schema correctly.
|
161
|
+
Backport #10098.
|
162
|
+
|
163
|
+
*Erik Peterson*
|
164
|
+
|
165
|
+
* Removed warning when `auto_explain_threshold_in_seconds` is set and the
|
166
|
+
connection adapter doesn't support explain.
|
167
|
+
This is causing a regression since the Active Record Railtie is trying to
|
168
|
+
connect to the development database in the application boot.
|
169
|
+
|
170
|
+
*Rafael Mendonça França*
|
171
|
+
|
172
|
+
* Do not reset `inheritance_column` when it's set explicitly.
|
173
|
+
Backport of #5327.
|
174
|
+
|
175
|
+
*kennyj + Fred Wu*
|
176
|
+
|
177
|
+
* Fix a problem wrong exception is occured
|
178
|
+
when raising no translatable exception in PostgreSQL.
|
179
|
+
|
180
|
+
*kennyj*
|
181
|
+
|
182
|
+
* Resets the postgres search path in the structure.sql after the structure
|
183
|
+
is dumped in order to find schema_migrations table when multiples schemas
|
184
|
+
are used.
|
185
|
+
Fixes #9796.
|
186
|
+
|
187
|
+
*Juan M. Cuello + Dembskiy Alexander*
|
188
|
+
|
189
|
+
* Reload the association target if it's stale. `@stale_state` should be nil
|
190
|
+
when a model isn't saved.
|
191
|
+
Fixes #7526.
|
192
|
+
|
193
|
+
*Larry Lv*
|
194
|
+
|
195
|
+
* Don't read CSV files during execution of `db:fixtures:load`. CSV support for
|
196
|
+
fixtures was removed some time ago but the task was still loading them, even
|
197
|
+
though later the code was looking for the related yaml file instead.
|
198
|
+
|
199
|
+
*kennyj*
|
200
|
+
|
201
|
+
|
202
|
+
## Rails 3.2.13 (Mar 18, 2013) ##
|
203
|
+
|
204
|
+
* Chaining multiple preloaded scopes will correctly preload all the scopes
|
205
|
+
at the same time.
|
206
|
+
|
207
|
+
*Chris Geihsler*
|
208
|
+
|
209
|
+
* Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values
|
210
|
+
compared to string columns.' This caused several regressions.
|
211
|
+
|
212
|
+
*Steve Klabnik*
|
213
|
+
|
214
|
+
* Fix overriding of attributes by `default_scope` on `ActiveRecord::Base#dup`.
|
215
|
+
|
216
|
+
*Hiroshige UMINO*
|
217
|
+
|
218
|
+
* Fix issue with overriding Active Record reader methods with a composed object
|
219
|
+
and using that attribute as the scope of a `uniqueness_of` validation.
|
220
|
+
Backport #7072.
|
221
|
+
|
222
|
+
*Peter Brown*
|
223
|
+
|
224
|
+
* Sqlite now preserves custom primary keys when copying or altering tables.
|
225
|
+
Fixes #9367.
|
226
|
+
Backport #2312.
|
227
|
+
|
228
|
+
*Sean Scally + Yves Senn*
|
229
|
+
|
230
|
+
* Preloading `has_many :through` associations with conditions won't
|
231
|
+
cache the `:through` association. This will prevent invalid
|
232
|
+
subsets to be cached.
|
233
|
+
Fixes #8423.
|
234
|
+
Backport #9252.
|
235
|
+
|
236
|
+
Example:
|
237
|
+
|
238
|
+
class User
|
239
|
+
has_many :posts
|
240
|
+
has_many :recent_comments, -> { where('created_at > ?', 1.week.ago) }, :through => :posts
|
241
|
+
end
|
242
|
+
|
243
|
+
a_user = User.includes(:recent_comments).first
|
244
|
+
|
245
|
+
# this is preloaded
|
246
|
+
a_user.recent_comments
|
247
|
+
|
248
|
+
# fetching the recent_comments through the posts association won't preload it.
|
249
|
+
a_user.posts
|
250
|
+
|
251
|
+
*Yves Senn*
|
252
|
+
|
253
|
+
* Fix handling of dirty time zone aware attributes
|
254
|
+
|
255
|
+
Previously, when `time_zone_aware_attributes` were enabled, after
|
256
|
+
changing a datetime or timestamp attribute and then changing it back
|
257
|
+
to the original value, `changed_attributes` still tracked the
|
258
|
+
attribute as changed. This caused `[attribute]_changed?` and
|
259
|
+
`changed?` methods to return true incorrectly.
|
260
|
+
|
261
|
+
Example:
|
262
|
+
|
263
|
+
in_time_zone 'Paris' do
|
264
|
+
order = Order.new
|
265
|
+
original_time = Time.local(2012, 10, 10)
|
266
|
+
order.shipped_at = original_time
|
267
|
+
order.save
|
268
|
+
order.changed? # => false
|
269
|
+
|
270
|
+
# changing value
|
271
|
+
order.shipped_at = Time.local(2013, 1, 1)
|
272
|
+
order.changed? # => true
|
273
|
+
|
274
|
+
# reverting to original value
|
275
|
+
order.shipped_at = original_time
|
276
|
+
order.changed? # => false, used to return true
|
277
|
+
end
|
278
|
+
|
279
|
+
Backport of #9073
|
280
|
+
Fixes #8898
|
281
|
+
|
282
|
+
*Lilibeth De La Cruz*
|
283
|
+
|
284
|
+
* Fix counter cache columns not updated when replacing `has_many :through`
|
285
|
+
associations.
|
286
|
+
Backport #8400.
|
287
|
+
Fix #7630.
|
288
|
+
|
289
|
+
*Matthew Robertson*
|
290
|
+
|
291
|
+
* Don't update `column_defaults` when calling destructive methods on column with default value.
|
292
|
+
Backport c517602.
|
293
|
+
Fix #6115.
|
294
|
+
|
295
|
+
*Piotr Sarnacki + Aleksey Magusev + Alan Daud*
|
296
|
+
|
297
|
+
* When `#count` is used in conjunction with `#uniq` we perform `count(:distinct => true)`.
|
298
|
+
Fix #6865.
|
299
|
+
|
300
|
+
Example:
|
301
|
+
|
302
|
+
relation.uniq.count # => SELECT COUNT(DISTINCT *)
|
303
|
+
|
304
|
+
*Yves Senn + Kaspar Schiess*
|
305
|
+
|
306
|
+
* Fix `ActiveRecord::Relation#pluck` when columns or tables are reserved words.
|
307
|
+
Backport #7536.
|
308
|
+
Fix #8968.
|
309
|
+
|
310
|
+
*Ian Lesperance + Yves Senn + Kaspar Schiess*
|
311
|
+
|
312
|
+
* Don't run explain on slow queries for database adapters that don't support it.
|
313
|
+
Backport #6197.
|
314
|
+
|
315
|
+
*Blake Smith*
|
316
|
+
|
317
|
+
* Revert round usec when comparing timestamp attributes in the dirty tracking.
|
318
|
+
Fixes #8460.
|
319
|
+
|
320
|
+
*Andrew White*
|
321
|
+
|
322
|
+
* Revert creation of through association models when using `collection=[]`
|
323
|
+
on a `has_many :through` association from an unsaved model.
|
324
|
+
Fix #7661, #8269.
|
325
|
+
|
326
|
+
*Ernie Miller*
|
327
|
+
|
328
|
+
* Fix undefined method `to_i` when calling `new` on a scope that uses an
|
329
|
+
Array; Fix FloatDomainError when setting integer column to NaN.
|
330
|
+
Fixes #8718, #8734, #8757.
|
331
|
+
|
332
|
+
*Jason Stirk + Tristan Harward*
|
333
|
+
|
334
|
+
* Serialized attributes can be serialized in integer columns.
|
335
|
+
Fix #8575.
|
336
|
+
|
337
|
+
*Rafael Mendonça França*
|
338
|
+
|
339
|
+
* Keep index names when using `alter_table` with sqlite3.
|
340
|
+
Fix #3489.
|
341
|
+
Backport #8522.
|
342
|
+
|
343
|
+
*Yves Senn*
|
344
|
+
|
345
|
+
* Recognize migrations placed in directories containing numbers and 'rb'.
|
346
|
+
Fix #8492.
|
347
|
+
Backport of #8500.
|
348
|
+
|
349
|
+
*Yves Senn*
|
350
|
+
|
351
|
+
* Add `ActiveRecord::Base.cache_timestamp_format` class attribute to control
|
352
|
+
the format of the timestamp value in the cache key.
|
353
|
+
This allows users to improve the precision of the cache key.
|
354
|
+
Fixes #8195.
|
355
|
+
|
356
|
+
*Rafael Mendonça França*
|
357
|
+
|
358
|
+
* Add `:nsec` date format. This can be used to improve the precision of cache key.
|
359
|
+
Please note that this format only works with Ruby 1.9, Ruby 1.8 will ignore it completely.
|
360
|
+
|
361
|
+
*Jamie Gaskins*
|
362
|
+
|
363
|
+
* Unscope `update_column(s)` query to ignore default scope.
|
364
|
+
|
365
|
+
When applying `default_scope` to a class with a where clause, using
|
366
|
+
`update_column(s)` could generate a query that would not properly update
|
367
|
+
the record due to the where clause from the `default_scope` being applied
|
368
|
+
to the update query.
|
369
|
+
|
370
|
+
class User < ActiveRecord::Base
|
371
|
+
default_scope where(active: true)
|
372
|
+
end
|
373
|
+
|
374
|
+
user = User.first
|
375
|
+
user.active = false
|
376
|
+
user.save!
|
377
|
+
|
378
|
+
user.update_column(:active, true) # => false
|
379
|
+
|
380
|
+
In this situation we want to skip the default_scope clause and just
|
381
|
+
update the record based on the primary key. With this change:
|
382
|
+
|
383
|
+
user.update_column(:active, true) # => true
|
384
|
+
|
385
|
+
Backport of #8436 fix.
|
386
|
+
|
387
|
+
*Carlos Antonio da Silva*
|
388
|
+
|
389
|
+
* Fix performance problem with primary_key method in PostgreSQL adapter when having many schemas.
|
390
|
+
Uses pg_constraint table instead of pg_depend table which has many records in general.
|
391
|
+
Fix #8414
|
392
|
+
|
393
|
+
*kennyj*
|
394
|
+
|
395
|
+
* Do not instantiate intermediate Active Record objects when eager loading.
|
396
|
+
These records caused `after_find` to run more than expected.
|
397
|
+
Fix #3313
|
398
|
+
Backport of #8403
|
399
|
+
|
400
|
+
*Yves Senn*
|
401
|
+
|
402
|
+
* Fix `pluck` to work with joins. Backport of #4942.
|
403
|
+
|
404
|
+
*Carlos Antonio da Silva*
|
405
|
+
|
406
|
+
* Fix a problem with `translate_exception` method in a non English environment.
|
407
|
+
Backport of #6397.
|
408
|
+
|
409
|
+
*kennyj*
|
410
|
+
|
411
|
+
* Fix dirty attribute checks for TimeZoneConversion with nil and blank
|
412
|
+
datetime attributes. Setting a nil datetime to a blank string should not
|
413
|
+
result in a change being flagged.
|
414
|
+
Fixes #8310.
|
415
|
+
Backport of #8311.
|
416
|
+
|
417
|
+
*Alisdair McDiarmid*
|
418
|
+
|
419
|
+
* Prevent mass assignment to the type column of polymorphic associations when using `build`.
|
420
|
+
Fixes #8265.
|
421
|
+
Backport of #8291.
|
422
|
+
|
423
|
+
*Yves Senn*
|
424
|
+
|
425
|
+
* When running migrations on Postgresql, the `:limit` option for `binary` and `text` columns is
|
426
|
+
silently dropped.
|
427
|
+
Previously, these migrations caused sql exceptions, because Postgresql doesn't support limits
|
428
|
+
on these types.
|
429
|
+
|
430
|
+
*Victor Costan*
|
431
|
+
|
432
|
+
* `#pluck` can be used on a relation with `select` clause.
|
433
|
+
Fixes #7551.
|
434
|
+
Backport of #8176.
|
435
|
+
|
436
|
+
Example:
|
437
|
+
|
438
|
+
Topic.select([:approved, :id]).order(:id).pluck(:id)
|
439
|
+
|
440
|
+
*Yves Senn*
|
441
|
+
|
442
|
+
* Use `nil?` instead of `blank?` to check whether dynamic finder with a bang
|
443
|
+
should raise RecordNotFound.
|
444
|
+
Fixes #7238.
|
445
|
+
|
446
|
+
*Nikita Afanasenko*
|
447
|
+
|
448
|
+
* Fix deleting from a HABTM join table upon destroying an object of a model
|
449
|
+
with optimistic locking enabled.
|
450
|
+
Fixes #5332.
|
451
|
+
|
452
|
+
*Nick Rogers*
|
453
|
+
|
454
|
+
* Use query cache/uncache when using ENV["DATABASE_URL"].
|
455
|
+
Fixes #6951.
|
456
|
+
Backport of #8074.
|
457
|
+
|
458
|
+
*kennyj*
|
459
|
+
|
460
|
+
* Do not create useless database transaction when building `has_one` association.
|
461
|
+
|
462
|
+
Example:
|
463
|
+
|
464
|
+
User.has_one :profile
|
465
|
+
User.new.build_profile
|
466
|
+
|
467
|
+
Backport of #8154.
|
468
|
+
|
469
|
+
*Bogdan Gusiev*
|
470
|
+
|
471
|
+
* `AR::Base#attributes_before_type_cast` now returns unserialized values for serialized attributes.
|
472
|
+
|
473
|
+
*Nikita Afanasenko*
|
474
|
+
|
475
|
+
* Fix issue that raises `NameError` when overriding the `accepts_nested_attributes` in child classes.
|
476
|
+
|
477
|
+
Before:
|
478
|
+
|
479
|
+
class Shared::Person < ActiveRecord::Base
|
480
|
+
has_one :address
|
481
|
+
|
482
|
+
accepts_nested_attributes :address, :reject_if => :all_blank
|
483
|
+
end
|
484
|
+
|
485
|
+
class Person < Shared::Person
|
486
|
+
accepts_nested_attributes :address
|
487
|
+
end
|
488
|
+
|
489
|
+
Person
|
490
|
+
#=> NameError: method `address_attributes=' not defined in Person
|
491
|
+
|
492
|
+
After:
|
493
|
+
|
494
|
+
Person
|
495
|
+
#=> Person(id: integer, ...)
|
496
|
+
|
497
|
+
Fixes #8131.
|
498
|
+
|
499
|
+
*Gabriel Sobrinho, Ricardo Henrique*
|
500
|
+
|
501
|
+
|
502
|
+
## Rails 3.2.12 (Feb 11, 2013) ##
|
503
|
+
|
504
|
+
* Quote numeric values being compared to non-numeric columns. Otherwise,
|
505
|
+
in some database, the string column values will be coerced to a numeric
|
506
|
+
allowing 0, 0.0 or false to match any string starting with a non-digit.
|
507
|
+
|
508
|
+
Example:
|
509
|
+
|
510
|
+
App.where(apikey: 0) # => SELECT * FROM users WHERE apikey = '0'
|
511
|
+
|
512
|
+
*Dylan Smith*
|
513
|
+
|
514
|
+
|
515
|
+
## Rails 3.2.11 (Jan 8, 2013) ##
|
516
|
+
|
517
|
+
* Fix querying with an empty hash *Damien Mathieu* [CVE-2013-0155]
|
518
|
+
|
519
|
+
|
520
|
+
## Rails 3.2.10 (Jan 2, 2013) ##
|
521
|
+
|
522
|
+
* CVE-2012-5664 options hashes should only be extracted if there are extra
|
523
|
+
parameters
|
524
|
+
|
525
|
+
|
526
|
+
## Rails 3.2.9 (Nov 12, 2012) ##
|
527
|
+
|
528
|
+
* Fix `find_in_batches` crashing when IDs are strings and start option is not specified.
|
529
|
+
|
530
|
+
*Alexis Bernard*
|
531
|
+
|
532
|
+
* Fix issue with collection associations calling first(n)/last(n) and attempting
|
533
|
+
to set the inverse association when `:inverse_of` was used. Fixes #8087.
|
534
|
+
|
535
|
+
*Carlos Antonio da Silva*
|
536
|
+
|
537
|
+
* Fix bug when Column is trying to type cast boolean values to integer.
|
538
|
+
Fixes #8067.
|
539
|
+
|
540
|
+
*Rafael Mendonça França*
|
541
|
+
|
542
|
+
* Fix bug where `rake db:test:prepare` tries to load the structure.sql into development database.
|
543
|
+
Fixes #8032.
|
544
|
+
|
545
|
+
*Grace Liu + Rafael Mendonça França*
|
546
|
+
|
547
|
+
* Fixed support for `DATABASE_URL` environment variable for rake db tasks. *Grace Liu*
|
548
|
+
|
549
|
+
* Fix bug where `update_columns` and `update_column` would not let you update the primary key column.
|
550
|
+
|
551
|
+
*Henrik Nyh*
|
552
|
+
|
553
|
+
* Decode URI encoded attributes on database connection URLs.
|
554
|
+
|
555
|
+
*Shawn Veader*
|
556
|
+
|
557
|
+
* Fix AR#dup to nullify the validation errors in the dup'ed object. Previously the original
|
558
|
+
and the dup'ed object shared the same errors.
|
559
|
+
|
560
|
+
*Christian Seiler*
|
561
|
+
|
562
|
+
* Synchronize around deleting from the reserved connections hash.
|
563
|
+
Fixes #7955
|
564
|
+
|
565
|
+
* PostgreSQL adapter correctly fetches default values when using
|
566
|
+
multiple schemas and domains in a db. Fixes #7914
|
567
|
+
|
568
|
+
*Arturo Pie*
|
569
|
+
|
570
|
+
* Fix deprecation notice when loading a collection association that
|
571
|
+
selects columns from other tables, if a new record was previously
|
572
|
+
built using that association.
|
573
|
+
|
574
|
+
*Ernie Miller*
|
575
|
+
|
576
|
+
* The postgres adapter now supports tables with capital letters.
|
577
|
+
Fix #5920
|
578
|
+
|
579
|
+
*Yves Senn*
|
580
|
+
|
581
|
+
* `CollectionAssociation#count` returns `0` without querying if the
|
582
|
+
parent record is not persisted.
|
583
|
+
|
584
|
+
Before:
|
585
|
+
|
586
|
+
person.pets.count
|
587
|
+
# SELECT COUNT(*) FROM "pets" WHERE "pets"."person_id" IS NULL
|
588
|
+
# => 0
|
589
|
+
|
590
|
+
After:
|
591
|
+
|
592
|
+
person.pets.count
|
593
|
+
# fires without sql query
|
594
|
+
# => 0
|
595
|
+
|
596
|
+
*Francesco Rodriguez*
|
597
|
+
|
598
|
+
* Fix `reset_counters` crashing on `has_many :through` associations.
|
599
|
+
Fix #7822.
|
600
|
+
|
601
|
+
*lulalala*
|
602
|
+
|
603
|
+
* ConnectionPool recognizes checkout_timeout spec key as taking
|
604
|
+
precedence over legacy wait_timeout spec key, can be used to avoid
|
605
|
+
conflict with mysql2 use of wait_timeout. Closes #7684.
|
606
|
+
|
607
|
+
*jrochkind*
|
608
|
+
|
609
|
+
* Rename field_changed? to _field_changed? so that users can create a field named field
|
610
|
+
|
611
|
+
*Akira Matsuda*, backported by *Steve Klabnik*
|
612
|
+
|
613
|
+
* Fix creation of through association models when using `collection=[]`
|
614
|
+
on a `has_many :through` association from an unsaved model.
|
615
|
+
Fix #7661.
|
616
|
+
|
617
|
+
*Ernie Miller*
|
618
|
+
|
619
|
+
* Explain only normal CRUD sql (select / update / insert / delete).
|
620
|
+
Fix problem that explains unexplainable sql. Closes #7544 #6458.
|
621
|
+
|
622
|
+
*kennyj*
|
623
|
+
|
624
|
+
* Backport test coverage to ensure that PostgreSQL auto-reconnect functionality
|
625
|
+
remains healthy.
|
626
|
+
|
627
|
+
*Steve Jorgensen*
|
628
|
+
|
629
|
+
* Use config['encoding'] instead of config['charset'] when executing
|
630
|
+
databases.rake in the mysql/mysql2. A correct option for a database.yml
|
631
|
+
is 'encoding'.
|
632
|
+
|
633
|
+
*kennyj*
|
634
|
+
|
635
|
+
* Fix ConnectionAdapters::Column.type_cast_code integer conversion,
|
636
|
+
to always convert values to integer calling #to_i. Fixes #7509.
|
637
|
+
|
638
|
+
*Thiago Pradi*
|
639
|
+
|
640
|
+
* Fix time column type casting for invalid time string values to correctly return nil.
|
641
|
+
|
642
|
+
*Adam Meehan*
|
643
|
+
|
644
|
+
* Fix `becomes` when using a configured `inheritance_column`.
|
645
|
+
|
646
|
+
*Yves Senn*
|
647
|
+
|
648
|
+
* Fix `reset_counters` when there are multiple `belongs_to` association with the
|
649
|
+
same foreign key and one of them have a counter cache.
|
650
|
+
Fixes #5200.
|
651
|
+
|
652
|
+
*Dave Desrochers*
|
653
|
+
|
654
|
+
* Round usec when comparing timestamp attributes in the dirty tracking.
|
655
|
+
Fixes #6975.
|
656
|
+
|
657
|
+
*kennyj*
|
658
|
+
|
659
|
+
* Use inversed parent for first and last child of has_many association.
|
660
|
+
|
661
|
+
*Ravil Bayramgalin*
|
662
|
+
|
663
|
+
* Fix Column.microseconds and Column.fast_string_to_date to avoid converting
|
664
|
+
timestamp seconds to a float, since it occasionally results in inaccuracies
|
665
|
+
with microsecond-precision times. Fixes #7352.
|
666
|
+
|
667
|
+
*Ari Pollak*
|
668
|
+
|
669
|
+
* Fix `increment!`, `decrement!`, `toggle!` that was skipping callbacks.
|
670
|
+
Fixes #7306.
|
671
|
+
|
672
|
+
*Rafael Mendonça França*
|
673
|
+
|
674
|
+
* Fix AR#create to return an unsaved record when AR::RecordInvalid is
|
675
|
+
raised. Fixes #3217.
|
676
|
+
|
677
|
+
*Dave Yeu*
|
678
|
+
|
679
|
+
* Remove unnecessary transaction when assigning has_one associations with a nil or equal value.
|
680
|
+
Fix #7191.
|
681
|
+
|
682
|
+
*kennyj*
|
683
|
+
|
684
|
+
* Allow store to work with an empty column.
|
685
|
+
Fix #4840.
|
686
|
+
|
687
|
+
*Jeremy Walker*
|
688
|
+
|
689
|
+
* Remove prepared statement from system query in postgresql adapter.
|
690
|
+
Fix #5872.
|
691
|
+
|
692
|
+
*Ivan Evtuhovich*
|
693
|
+
|
694
|
+
* Make sure `:environment` task is executed before `db:schema:load` or `db:structure:load`
|
695
|
+
Fixes #4772.
|
696
|
+
|
697
|
+
*Seamus Abshere*
|
698
|
+
|
699
|
+
|
700
|
+
## Rails 3.2.8 (Aug 9, 2012) ##
|
701
|
+
|
702
|
+
* Do not consider the numeric attribute as changed if the old value is zero and the new value
|
703
|
+
is not a string.
|
704
|
+
Fixes #7237.
|
705
|
+
|
706
|
+
*Rafael Mendonça França*
|
707
|
+
|
708
|
+
* Removes the deprecation of `update_attribute`. *fxn*
|
709
|
+
|
710
|
+
* Reverted the deprecation of `composed_of`. *Rafael Mendonça França*
|
711
|
+
|
712
|
+
* Reverted the deprecation of `*_sql` association options. They will
|
713
|
+
be deprecated in 4.0 instead. *Jon Leighton*
|
714
|
+
|
715
|
+
* Do not eager load AR session store. ActiveRecord::SessionStore depends on the abstract store
|
716
|
+
in Action Pack. Eager loading this class would break client code that eager loads Active Record
|
717
|
+
standalone.
|
718
|
+
Fixes #7160
|
719
|
+
|
720
|
+
*Xavier Noria*
|
721
|
+
|
722
|
+
* Do not set RAILS_ENV to "development" when using `db:test:prepare` and related rake tasks.
|
723
|
+
This was causing the truncation of the development database data when using RSpec.
|
724
|
+
Fixes #7175.
|
725
|
+
|
726
|
+
*Rafael Mendonça França*
|
727
|
+
|
728
|
+
## Rails 3.2.7 (Jul 26, 2012) ##
|
729
|
+
|
730
|
+
* `:finder_sql` and `:counter_sql` options on collection associations
|
731
|
+
are deprecated. Please transition to using scopes.
|
732
|
+
|
733
|
+
*Jon Leighton*
|
734
|
+
|
735
|
+
* `:insert_sql` and `:delete_sql` options on `has_and_belongs_to_many`
|
736
|
+
associations are deprecated. Please transition to using `has_many
|
737
|
+
:through`
|
738
|
+
|
739
|
+
*Jon Leighton*
|
740
|
+
|
741
|
+
* `composed_of` has been deprecated. You'll have to write your own accessor
|
742
|
+
and mutator methods if you'd like to use value objects to represent some
|
743
|
+
portion of your models.
|
744
|
+
|
745
|
+
*Steve Klabnik*
|
746
|
+
|
747
|
+
* `update_attribute` has been deprecated. Use `update_column` if
|
748
|
+
you want to bypass mass-assignment protection, validations, callbacks,
|
749
|
+
and touching of updated_at. Otherwise please use `update_attributes`.
|
750
|
+
|
751
|
+
*Steve Klabnik*
|
752
|
+
|
753
|
+
## Rails 3.2.6 (Jun 12, 2012) ##
|
754
|
+
|
755
|
+
* protect against the nesting of hashes changing the
|
756
|
+
table context in the next call to build_from_hash. This fix
|
757
|
+
covers this case as well.
|
758
|
+
|
759
|
+
CVE-2012-2695
|
760
|
+
|
761
|
+
* Revert earlier 'perf fix' (see 3.2.4 changelog / GH #6289). This
|
762
|
+
change introduced a regression (GH #6609). assoc.clear and
|
763
|
+
assoc.delete_all have loaded the association before doing the delete
|
764
|
+
since at least Rails 2.3. Doing the delete without loading the
|
765
|
+
records means that the `before_remove` and `after_remove` callbacks do
|
766
|
+
not get invoked. Therefore, this change was less a fix a more an
|
767
|
+
optimisation, which should only have gone into master.
|
768
|
+
|
769
|
+
*Jon Leighton*
|
770
|
+
|
771
|
+
## Rails 3.2.5 (Jun 1, 2012) ##
|
772
|
+
|
773
|
+
* Restore behavior of Active Record 3.2.3 scopes.
|
774
|
+
A series of commits relating to preloading and scopes caused a regression.
|
775
|
+
|
776
|
+
*Andrew White*
|
777
|
+
|
778
|
+
|
779
|
+
## Rails 3.2.4 (May 31, 2012) ##
|
780
|
+
|
781
|
+
* Perf fix: Don't load the records when doing assoc.delete_all.
|
782
|
+
GH #6289. *Jon Leighton*
|
783
|
+
|
784
|
+
* Association preloading shouldn't be affected by the current scoping.
|
785
|
+
This could cause infinite recursion and potentially other problems.
|
786
|
+
See GH #5667. *Jon Leighton*
|
787
|
+
|
788
|
+
* Datetime attributes are forced to be changed. GH #3965
|
789
|
+
|
790
|
+
* Fix attribute casting. GH #5549
|
791
|
+
|
792
|
+
* Fix #5667. Preloading should ignore scoping.
|
793
|
+
|
794
|
+
* Predicate builder should not recurse for determining where columns.
|
795
|
+
Thanks to Ben Murphy for reporting this! CVE-2012-2661
|
796
|
+
|
797
|
+
|
798
|
+
## Rails 3.2.3 (March 30, 2012) ##
|
799
|
+
|
800
|
+
* Added find_or_create_by_{attribute}! dynamic method. *Andrew White*
|
801
|
+
|
802
|
+
* Whitelist all attribute assignment by default. Change the default for newly generated applications to whitelist all attribute assignment. Also update the generated model classes so users are reminded of the importance of attr_accessible. *NZKoz*
|
803
|
+
|
804
|
+
* Update ActiveRecord::AttributeMethods#attribute_present? to return false for empty strings. *Jacobkg*
|
805
|
+
|
806
|
+
* Fix associations when using per class databases. *larskanis*
|
807
|
+
|
808
|
+
* Revert setting NOT NULL constraints in add_timestamps *fxn*
|
809
|
+
|
810
|
+
* Fix mysql to use proper text types. Fixes #3931. *kennyj*
|
811
|
+
|
812
|
+
* Fix #5069 - Protect foreign key from mass assignment through association builder. *byroot*
|
813
|
+
|
814
|
+
|
815
|
+
## Rails 3.2.2 (March 1, 2012) ##
|
816
|
+
|
817
|
+
* No changes.
|
818
|
+
|
819
|
+
|
820
|
+
## Rails 3.2.1 (January 26, 2012) ##
|
821
|
+
|
822
|
+
* The threshold for auto EXPLAIN is ignored if there's no logger. *fxn*
|
823
|
+
|
824
|
+
* Call `to_s` on the value passed to `table_name=`, in particular symbols
|
825
|
+
are supported (regression). *Sergey Nartimov*
|
826
|
+
|
827
|
+
* Fix possible race condition when two threads try to define attribute
|
828
|
+
methods for the same class. *Jon Leighton*
|
829
|
+
|
830
|
+
|
831
|
+
## Rails 3.2.0 (January 20, 2012) ##
|
832
|
+
|
833
|
+
* Added a `with_lock` method to ActiveRecord objects, which starts
|
834
|
+
a transaction, locks the object (pessimistically) and yields to the block.
|
835
|
+
The method takes one (optional) parameter and passes it to `lock!`.
|
836
|
+
|
837
|
+
Before:
|
838
|
+
|
839
|
+
class Order < ActiveRecord::Base
|
840
|
+
def cancel!
|
841
|
+
transaction do
|
842
|
+
lock!
|
843
|
+
# ... cancelling logic
|
844
|
+
end
|
845
|
+
end
|
846
|
+
end
|
847
|
+
|
848
|
+
After:
|
849
|
+
|
850
|
+
class Order < ActiveRecord::Base
|
851
|
+
def cancel!
|
852
|
+
with_lock do
|
853
|
+
# ... cancelling logic
|
854
|
+
end
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
858
|
+
*Olek Janiszewski*
|
859
|
+
|
860
|
+
* 'on' and 'ON' boolean columns values are type casted to true
|
861
|
+
*Santiago Pastorino*
|
862
|
+
|
863
|
+
* Added ability to run migrations only for given scope, which allows
|
864
|
+
to run migrations only from one engine (for example to revert changes
|
865
|
+
from engine that you want to remove).
|
866
|
+
|
867
|
+
Example:
|
868
|
+
rake db:migrate SCOPE=blog
|
869
|
+
|
870
|
+
*Piotr Sarnacki*
|
871
|
+
|
872
|
+
* Migrations copied from engines are now scoped with engine's name,
|
873
|
+
for example 01_create_posts.blog.rb. *Piotr Sarnacki*
|
874
|
+
|
875
|
+
* Implements `AR::Base.silence_auto_explain`. This method allows the user to
|
876
|
+
selectively disable automatic EXPLAINs within a block. *fxn*
|
877
|
+
|
878
|
+
* Implements automatic EXPLAIN logging for slow queries.
|
879
|
+
|
880
|
+
A new configuration parameter `config.active_record.auto_explain_threshold_in_seconds`
|
881
|
+
determines what's to be considered a slow query. Setting that to `nil` disables
|
882
|
+
this feature. Defaults are 0.5 in development mode, and `nil` in test and production
|
883
|
+
modes.
|
884
|
+
|
885
|
+
As of this writing there's support for SQLite, MySQL (mysql2 adapter), and
|
886
|
+
PostgreSQL.
|
887
|
+
|
888
|
+
*fxn*
|
889
|
+
|
890
|
+
* Implemented ActiveRecord::Relation#pluck method
|
891
|
+
|
892
|
+
Method returns Array of column value from table under ActiveRecord model
|
893
|
+
|
894
|
+
Client.pluck(:id)
|
895
|
+
|
896
|
+
*Bogdan Gusiev*
|
897
|
+
|
898
|
+
* Automatic closure of connections in threads is deprecated. For example
|
899
|
+
the following code is deprecated:
|
900
|
+
|
901
|
+
Thread.new { Post.find(1) }.join
|
902
|
+
|
903
|
+
It should be changed to close the database connection at the end of
|
904
|
+
the thread:
|
905
|
+
|
906
|
+
Thread.new {
|
907
|
+
Post.find(1)
|
908
|
+
Post.connection.close
|
909
|
+
}.join
|
910
|
+
|
911
|
+
Only people who spawn threads in their application code need to worry
|
912
|
+
about this change.
|
913
|
+
|
914
|
+
* Deprecated:
|
915
|
+
|
916
|
+
* `set_table_name`
|
917
|
+
* `set_inheritance_column`
|
918
|
+
* `set_sequence_name`
|
919
|
+
* `set_primary_key`
|
920
|
+
* `set_locking_column`
|
921
|
+
|
922
|
+
Use an assignment method instead. For example, instead of `set_table_name`, use `self.table_name=`:
|
923
|
+
|
924
|
+
class Project < ActiveRecord::Base
|
925
|
+
self.table_name = "project"
|
926
|
+
end
|
927
|
+
|
928
|
+
Or define your own `self.table_name` method:
|
929
|
+
|
930
|
+
class Post < ActiveRecord::Base
|
931
|
+
def self.table_name
|
932
|
+
"special_" + super
|
933
|
+
end
|
934
|
+
end
|
935
|
+
Post.table_name # => "special_posts"
|
936
|
+
|
937
|
+
*Jon Leighton*
|
938
|
+
|
939
|
+
* Generated association methods are created within a separate module to allow overriding and
|
940
|
+
composition using `super`. For a class named `MyModel`, the module is named
|
941
|
+
`MyModel::GeneratedFeatureMethods`. It is included into the model class immediately after
|
942
|
+
the `generated_attributes_methods` module defined in ActiveModel, so association methods
|
943
|
+
override attribute methods of the same name. *Josh Susser*
|
944
|
+
|
945
|
+
* Implemented ActiveRecord::Relation#explain. *fxn*
|
946
|
+
|
947
|
+
* Add ActiveRecord::Relation#uniq for generating unique queries.
|
948
|
+
|
949
|
+
Before:
|
950
|
+
|
951
|
+
Client.select('DISTINCT name')
|
952
|
+
|
953
|
+
After:
|
954
|
+
|
955
|
+
Client.select(:name).uniq
|
956
|
+
|
957
|
+
This also allows you to revert the unqueness in a relation:
|
958
|
+
|
959
|
+
Client.select(:name).uniq.uniq(false)
|
960
|
+
|
961
|
+
*Jon Leighton*
|
962
|
+
|
963
|
+
* Support index sort order in sqlite, mysql and postgres adapters. *Vlad Jebelev*
|
964
|
+
|
965
|
+
* Allow the :class_name option for associations to take a symbol (:Client) in addition to
|
966
|
+
a string ('Client').
|
967
|
+
|
968
|
+
This is to avoid confusing newbies, and to be consistent with the fact that other options
|
969
|
+
like :foreign_key already allow a symbol or a string.
|
970
|
+
|
971
|
+
*Jon Leighton*
|
972
|
+
|
973
|
+
* In development mode the db:drop task also drops the test database. For symmetry with
|
974
|
+
the db:create task. *Dmitriy Kiriyenko*
|
975
|
+
|
976
|
+
* Added ActiveRecord::Base.store for declaring simple single-column key/value stores *DHH*
|
977
|
+
|
978
|
+
class User < ActiveRecord::Base
|
979
|
+
store :settings, accessors: [ :color, :homepage ]
|
980
|
+
end
|
981
|
+
|
982
|
+
u = User.new(color: 'black', homepage: '37signals.com')
|
983
|
+
u.color # Accessor stored attribute
|
984
|
+
u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor
|
985
|
+
|
986
|
+
|
987
|
+
* MySQL: case-insensitive uniqueness validation avoids calling LOWER when
|
988
|
+
the column already uses a case-insensitive collation. Fixes #561.
|
989
|
+
|
990
|
+
*Joseph Palermo*
|
991
|
+
|
992
|
+
* Transactional fixtures enlist all active database connections. You can test
|
993
|
+
models on different connections without disabling transactional fixtures.
|
994
|
+
|
995
|
+
*Jeremy Kemper*
|
996
|
+
|
997
|
+
* Add first_or_create, first_or_create!, first_or_initialize methods to Active Record. This is a
|
998
|
+
better approach over the old find_or_create_by dynamic methods because it's clearer which
|
999
|
+
arguments are used to find the record and which are used to create it:
|
1000
|
+
|
1001
|
+
User.where(:first_name => "Scarlett").first_or_create!(:last_name => "Johansson")
|
1002
|
+
|
1003
|
+
*Andrés Mejía*
|
1004
|
+
|
1005
|
+
* Fix nested attributes bug where _destroy parameter is taken into account
|
1006
|
+
during :reject_if => :all_blank (fixes #2937)
|
1007
|
+
|
1008
|
+
*Aaron Christy*
|
1009
|
+
|
1010
|
+
* Add ActiveSupport::Cache::NullStore for use in development and testing.
|
1011
|
+
|
1012
|
+
*Brian Durand*
|
1013
|
+
|
1014
|
+
Please check [3-1-stable](https://github.com/rails/rails/blob/3-1-stable/activerecord/CHANGELOG.md) for previous changes.
|