1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases
Francesco Rodriguez aa202adf6c Count returns 0 without querying if parent is not saved
Patches `CollectionAssociation#count` to return 0 without querying
if the parent record is new. Consider the following code:

    class Account
      has_many :dossiers
    end

    class Dossier
      belongs_to :account
    end

    a = Account.new
    a.dossiers.build

    # before patch
    a.dossiers.count
    # SELECT COUNT(*) FROM "dossiers" WHERE "dossiers"."account_id" IS NULL
    # => 0

    # after
    a.dosiers.count # fires without sql query
    # => 0

Fixes #1856.
2012-10-03 18:02:14 -05:00
..
adapters Moves column dump specific code to a module included in AbstractAdapter 2012-09-14 08:43:47 -04:00
associations Count returns 0 without querying if parent is not saved 2012-10-03 18:02:14 -05:00
attribute_methods
coders
connection_adapters rename AR::Model::Tag to AR::Tag - fixes #7714 2012-09-20 12:43:12 -05:00
connection_specification fixed support for DATABASE_URL for rake db tasks 2012-09-11 20:40:13 -07:00
fixtures
migration
relation fix querying with an empty hash 2012-09-19 15:57:22 +02:00
tasks Style: remove hash noise 2012-09-21 12:08:02 -07:00
validations
adapter_test.rb Ensure disconnecting or reconnecting resets the transaction state 2012-09-15 00:03:04 +01:00
aggregations_test.rb
ar_schema_test.rb
associations_test.rb
attribute_methods_test.rb test cleanup, remove ruby_type because it's no longer needed 2012-09-03 20:38:14 +02:00
autosave_association_test.rb
base_test.rb Remove mass assignment security from ActiveRecord 2012-09-16 23:58:19 -05:00
batches_test.rb Fix test_find_in_batches_should_use_any_column_as_primary_key 2012-09-22 10:57:54 -03:00
binary_test.rb
bind_parameter_test.rb
calculations_test.rb Fix pluck when columns/tables are reserved words. 2012-09-05 18:00:07 -04:00
callbacks_test.rb Fix collisions with before and after validation callbacks. 2012-09-23 12:53:50 -06:00
clone_test.rb
column_alias_test.rb
column_definition_test.rb
column_test.rb
connection_management_test.rb
connection_pool_test.rb ConnectionPool, unify exceptions, ConnectionTimeoutError 2012-09-11 10:38:27 -04:00
counter_cache_test.rb Fix reset_counters() crashing on has_many :through associations. 2012-10-02 23:49:32 +08:00
custom_locking_test.rb
database_statements_test.rb
date_time_test.rb
defaults_test.rb
deprecated_dynamic_methods_test.rb Remove mass assignment security from ActiveRecord 2012-09-16 23:58:19 -05:00
dirty_test.rb Change query pattern case insensitive 2012-09-29 04:57:27 +09:00
dup_test.rb Remove mass_assignment_options from ActiveRecord 2012-09-16 23:59:05 -05:00
explain_subscriber_test.rb Don't explain except normal CRUD sql. 2012-09-17 00:22:34 +09:00
explain_test.rb
finder_respond_to_test.rb
finder_test.rb Raise MissingAttributeError on query methods 2012-09-08 17:40:01 -04:00
fixtures_test.rb
forbidden_attributes_protection_test.rb Remove mass_assignment_options from ActiveRecord 2012-09-16 23:59:05 -05:00
habtm_destroy_order_test.rb
helper.rb Fix annoy warning, when executing testcase. 2012-09-11 00:17:08 +09:00
hot_compatibility_test.rb Add an explicit test for hot compatibility 2012-09-28 18:08:14 +01:00
i18n_test.rb
inclusion_test.rb
inheritance_test.rb test cleanup, remove ruby_type because it's no longer needed 2012-09-03 20:38:14 +02:00
invalid_date_test.rb
invertible_migration_test.rb
json_serialization_test.rb
lifecycle_test.rb
locking_test.rb
log_subscriber_test.rb
migration_test.rb
migrator_test.rb
mixin_test.rb
modules_test.rb
multiple_db_test.rb
named_scope_test.rb
nested_attributes_test.rb Merge pull request #5248 from jcoleman/should-unset-association-when-an-existing-record-is-destroyed 2012-09-21 02:40:26 -07:00
persistence_test.rb Remove mass_assignment_options from ActiveRecord 2012-09-16 23:59:05 -05:00
pooled_connections_test.rb
primary_keys_test.rb
query_cache_test.rb
quoting_test.rb
readonly_test.rb
reaper_test.rb
reflection_test.rb
relation_scoping_test.rb
relation_test.rb
relations_test.rb
reload_models_test.rb
sanitize_test.rb
schema_dumper_test.rb Moves column dump specific code to a module included in AbstractAdapter 2012-09-14 08:43:47 -04:00
serialization_test.rb
serialized_attribute_test.rb
store_test.rb fix warning: method redefined 2012-10-02 13:32:54 -03:00
test_case.rb
timestamp_test.rb
transaction_callbacks_test.rb Fix test 2012-09-15 00:41:56 +01:00
transaction_isolation_test.rb Skip tests for non-supported isolation levels 2012-09-26 04:29:25 +09:00
transactions_test.rb Get rid of global variable in AR transactions test 2012-09-20 23:14:35 -03:00
unconnected_test.rb
validations_repair_helper.rb
validations_test.rb Remove mass assignment security from ActiveRecord 2012-09-16 23:58:19 -05:00
xml_serialization_test.rb Fix AR tests due to builder change with nil values / empty strings 2012-09-07 13:31:28 -03:00
yaml_serialization_test.rb