module NoBrainer::Criteria::Update
Public Instance Methods
replace_all(*a, &b)
click to toggle source
# File lib/no_brainer/criteria/update.rb, line 8 def replace_all(*a, &b) perform_update(:replace, a, b) end
update_all(*a, &b)
click to toggle source
# File lib/no_brainer/criteria/update.rb, line 4 def update_all(*a, &b) perform_update(:update, a, b) end
Private Instance Methods
perform_update(type, args, block)
click to toggle source
# File lib/no_brainer/criteria/update.rb, line 14 def perform_update(type, args, block) args[0] = model.persistable_attributes(args[0]) if !args.empty? && args.first.is_a?(Hash) # can't use without_distinct when passed a block as the operation may be # performed many times, which might not be idempotent. clause = block ? self : without_distinct run { clause.without_plucking.without_ordering.to_rql.__send__(type, *args, &block) } end