Disable callbacks with save, unless specified

I’d like calls to save to not use callbacks, unless specified.

I imagine it would be something like this :

def save(use_callbacks=false)

end

this would allow me to use callbacks if required.

What would the content of the method be? I am unsure about this.

Any help would be greately appreciated, thanks

Chris

Hi Chris

do you just want to bypass all the validations ?

If so just call instance.save(false), the method already exists.

hth

Thibaut

Thanks Thibaut.

I dont want to bypass the validations, just the callbacks.
I want to change it so that by default, .save will not use the
ActiveRecord callbacks (before_save,after_save, etc). and make it so
save(true) WILL use the callbacks.

Any ideas?

Thanks
Chris

also i want to change it so that update doesn’t call the callbacks by
default, only when called update(true). I know update_without_callbacks
exists.