core/app/models/gaku/address.rb in gaku-0.0.1 vs core/app/models/gaku/address.rb in gaku-0.0.2
- old
+ new
@@ -25,10 +25,10 @@
before_create :ensure_first_primary, on: :create
after_save :update_primary_address_field
after_destroy :reset_counter_cache
def make_primary
- addresses.where('id != ?', id).update_all(primary: false)
+ addresses.where.not(id: id).update_all(primary: false)
update_attribute(:primary, true)
update_primary_address_field
end
def soft_delete