Skip to content

Commit

Permalink
Literal key is stored in the options instead of the upsert_keys like …
Browse files Browse the repository at this point in the history
…the where condition
  • Loading branch information
manuquentin committed Apr 25, 2018
1 parent 9d484ec commit e727f95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/active_record_upsert/arel/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Arel
module Crud
def compile_upsert(upsert_keys, upsert_options, upsert_values, insert_values, wheres)
# Support non-attribute key (like `md5(my_attribute)``)
target = self[upsert_keys.kind_of?(Hash) ? ::Arel::Nodes::SqlLiteral.new(upsert_keys[:literal]) : upsert_keys.join(',')]
target = self[upsert_options.key?(:literal) ? ::Arel::Nodes::SqlLiteral.new(upsert_options[:literal]) : upsert_keys.join(',')]
on_conflict_do_update = OnConflictDoUpdateManager.new

on_conflict_do_update.target = target
Expand Down

0 comments on commit e727f95

Please sign in to comment.