diff options
author | Aaron Pfeifer <aaron.pfeifer@gmail.com> | 2013-03-27 22:27:47 -0400 |
---|---|---|
committer | Aaron Pfeifer <aaron.pfeifer@gmail.com> | 2013-03-27 22:27:47 -0400 |
commit | 482f8c15b1d699c95bfbc3d836f674a09c0d9031 (patch) | |
tree | 6d51a1488caf72c2328ac8dc7fd39fee64606580 /activerecord/lib | |
parent | 57fbcc524780ce386241c8def372984583e585d6 (diff) | |
download | rails-482f8c15b1d699c95bfbc3d836f674a09c0d9031.tar.gz rails-482f8c15b1d699c95bfbc3d836f674a09c0d9031.tar.bz2 rails-482f8c15b1d699c95bfbc3d836f674a09c0d9031.zip |
Fix updates not working within after_create hooks
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f881778591..42cece3ad0 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -443,7 +443,7 @@ module ActiveRecord real_column = db_columns_with_values[i].first bind_attrs[column] = klass.connection.substitute_at(real_column, i) end - stmt = klass.unscoped.where(klass.arel_table[klass.primary_key].eq(id_was)).arel.compile_update(bind_attrs) + stmt = klass.unscoped.where(klass.arel_table[klass.primary_key].eq(id_was || id)).arel.compile_update(bind_attrs) klass.connection.update stmt, 'SQL', db_columns_with_values end end |