1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/active_record
Joe Rafaniello 0379da6abc Fix uniqueness validation with an after_create hook.
record.id_was is nil in after_create/after_save, so we should use
id in these cases.

While this logic feels incomplete, the existing update_record uses the same
logic:
2fda4e0874/activerecord/lib/active_record/relation.rb (L83)

This logic was originally added for a similar problem:
updates not working with after_create hook.

See: 482f8c15b1

Followup to #23581
Fixes #23844
2016-02-25 10:13:12 -05:00
..
associations Merge pull request #23794 from matthewd/mutation-safe-to_a 2016-02-21 09:13:56 +10:30
attribute nodoc ActiveRecord::Attribute::UserProvidedDefault. [ci skip] 2015-10-13 13:24:07 +02:00
attribute_methods Merge pull request #23395 from PareshGupta/remove-unused-constant 2016-02-10 20:29:48 -03:00
attribute_set Implement equality comparison on AttributeSet and friends 2015-10-06 08:52:28 -06:00
coders Clean up the implementation of AR::Dirty 2015-09-24 14:06:59 -06:00
connection_adapters Merge pull request #22748 from Azzurrio/master 2016-02-22 22:33:25 +10:30
fixture_set Merge pull request #20574 from repinel/fix-db-fixtures-load 2015-09-30 11:06:41 +02:00
locale
locking Fix ActiveRecord::Locking doc [ci skip] 2015-09-24 00:33:43 +03:00
migration Correctly show deprecation warning for incompatible migrations 2016-02-12 13:45:41 +05:30
railties Add environment back to db:structure:load 2016-01-23 19:14:39 +00:00
relation Mutating the result of Relation#to_a should not affect the relation 2016-02-21 03:28:18 +10:30
scoping Revert "Remove valid_scope_name? check - use ruby" 2016-01-28 18:37:39 +09:00
tasks reestablish previous connection after creating all databases 2016-02-23 08:13:09 -08:00
type Require only necessary concurrent-ruby classes. 2015-11-04 21:12:28 -05:00
type_caster docs, ActiveRecord::TypeCaster is not part of the public API. 2015-11-07 12:26:09 -05:00
validations Fix uniqueness validation with an after_create hook. 2016-02-25 10:13:12 -05:00
aggregations.rb reflect mapping to match initialize 2016-01-25 20:56:42 -08:00
association_relation.rb Mutating the result of Relation#to_a should not affect the relation 2016-02-21 03:28:18 +10:30
associations.rb Merge pull request #23387 from mcfiredrill/clarify-touching-callbacks 2016-01-31 23:13:24 +01:00
attribute.rb Further encapsulate dirty checking on Attribute 2015-10-02 08:03:11 -04:00
attribute_assignment.rb Addresses #23568 2016-02-09 08:01:29 -06:00
attribute_decorators.rb
attribute_methods.rb Remove unused class AttributeMethodCache 2016-02-02 11:21:52 +05:30
attribute_mutation_tracker.rb Add Singleton in NullMutationTracker class 2015-10-03 16:11:02 +02:00
attribute_set.rb Implement equality comparison on AttributeSet and friends 2015-10-06 08:52:28 -06:00
attributes.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
autosave_association.rb Fixed setting errors details on autosaved associations 2015-10-28 20:18:29 +01:00
base.rb Remove duplicated require 'arel' 2016-02-06 17:51:03 +09:00
callbacks.rb Fix grammar a to an [ci skip] 2016-02-13 20:44:44 +09:00
collection_cache_key.rb Fix AR::Relation#cache_key to remove select scope added by user 2016-01-24 22:36:13 +05:30
connection_handling.rb Remove legacy mysql adapter 2015-12-21 08:46:55 +09:00
core.rb Extract a Relation#arel_attribute 2016-02-04 09:14:05 +10:30
counter_cache.rb Pluralize counter_cache column name in example [ci skip] 2016-01-20 11:58:11 +05:30
dynamic_matchers.rb
enum.rb Merge branch '5-0-beta-sec' 2016-01-25 11:25:11 -08:00
errors.rb Introduce ActiveRecord::IrreversibleOrderError 2016-01-27 12:53:51 +02:00
explain.rb
explain_registry.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
explain_subscriber.rb typo 2015-10-20 22:58:50 -07:00
fixtures.rb Refer to rails command instead of rake in a bunch of places 2015-12-18 13:01:10 +01:00
gem_version.rb Prep release for Rails 5 beta3 2016-02-24 10:27:02 -05:00
inheritance.rb Defer Arel attribute lookup to the model class 2016-02-04 08:02:45 +10:30
integration.rb fixes #21815 2015-10-16 15:09:45 +02:00
internal_metadata.rb Rename active_record_internal_metadatas to ar_internal_metadata 2016-02-01 15:52:30 +00:00
legacy_yaml_adapter.rb
log_subscriber.rb
migration.rb refer to rails command instead of rake in environment error 2016-01-19 17:15:59 +09:00
model_schema.rb Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadata 2016-02-01 15:41:37 +00:00
nested_attributes.rb [ci skip] Improve the readability of documents of nested_attributes 2016-02-24 10:24:14 +09:00
no_touching.rb
null_relation.rb Mutating the result of Relation#to_a should not affect the relation 2016-02-21 03:28:18 +10:30
persistence.rb - Updated persistence documentation to make it clear that save and save! won't update a record if validation fails. 2016-01-31 00:36:23 +05:30
query_cache.rb
querying.rb Ensure prepared statement caching still occurs with Adequate Record 2016-02-11 08:54:58 -07:00
railtie.rb make rake proxy work in rails engines 2016-01-31 09:49:48 +09:00
readonly_attributes.rb
reflection.rb build scope chain functionally and remove caching 2016-02-10 13:49:03 -08:00
relation.rb Mutating the result of Relation#to_a should not affect the relation 2016-02-21 03:28:18 +10:30
result.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
runtime_registry.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
sanitization.rb Fix grammar a to an [ci skip] 2016-02-13 20:44:44 +09:00
schema.rb Use hash like syntax for InternalMetadata 2016-01-08 09:27:25 -06:00
schema_dumper.rb Revert "Dump indexes in create_table instead of add_index" 2016-02-05 13:33:48 -07:00
schema_migration.rb Avoid extra show variables in migration 2016-02-01 13:05:47 +09:00
scoping.rb Active scopes apply to child classes, though not parents/siblings 2016-01-12 05:43:58 +10:30
secure_token.rb Revert "Merge pull request #20835 from glittershark/if-and-unless-in-secure-token" 2016-01-14 21:52:03 +01:00
serialization.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
statement_cache.rb Ensure prepared statement caching still occurs with Adequate Record 2016-02-11 08:54:58 -07:00
store.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
suppressor.rb Ensure suppressor runs before validations 2016-02-24 14:33:22 -05:00
table_metadata.rb Defer Arel attribute lookup to the model class 2016-02-04 08:02:45 +10:30
timestamp.rb [ci skip] Add note about tsrange and timezone awareness to docs 2016-01-22 14:35:52 +03:00
touch_later.rb Make sure we touch all the parents when touch_later. 2015-12-06 16:53:00 -05:00
transactions.rb Fix the API documentation layout of after_*_commit 2016-01-20 18:21:46 +02:00
translation.rb
type.rb applies new doc guidelines to Active Record. 2015-10-14 17:40:00 +02:00
type_caster.rb docs, ActiveRecord::TypeCaster is not part of the public API. 2015-11-07 12:26:09 -05:00
validations.rb Fix grammar a to an [ci skip] 2016-02-13 20:44:44 +09:00
version.rb