I require to use update_column in my Rails application to prevent callbacks from being run. I have my ActiveRecord model with enum:
class Car < ActiveRecord::Base
  enum state: [:not_used, :used]
end
In normal scenario (i.e. when I do want the callbacks to run) I can use something like that:
@car.update_attribute :state, :not_used
Is it possible to do something similar with update_column?
I am using Rails 4.2
update_column doesn't recognize symbols as a variant of the enum. I think that you have to Use Car.states[:not_used] instead of :not_used. Like this:
@car.update_column :state, Car.states[:not_used]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With