diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-24 15:48:46 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-24 15:59:02 -0700 |
commit | 34d79fad85b0388270300a91430211ddc82cb183 (patch) | |
tree | 04057568c28e8eee5506410cfddb0961c73159e3 /activerecord | |
parent | 2cbf948f25a1a0eeeea641d14a95480432cbda24 (diff) | |
download | rails-34d79fad85b0388270300a91430211ddc82cb183.tar.gz rails-34d79fad85b0388270300a91430211ddc82cb183.tar.bz2 rails-34d79fad85b0388270300a91430211ddc82cb183.zip |
setting the primary key on the update manager
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d4c5c85594..9a882ba01a 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -169,6 +169,7 @@ module ActiveRecord # Apply limit and order only if they're both present if @limit_value.present? == @order_values.present? stmt = arel.compile_update(Arel::SqlLiteral.new(@klass.send(:sanitize_sql_for_assignment, updates))) + stmt.key = @klass.arel_table[@klass.primary_key] @klass.connection.update stmt.to_sql else except(:limit, :order).update_all(updates) |