Skip to content

Instantly share code, notes, and snippets.

@almokhtarbr
Created October 13, 2021 22:07
Show Gist options
  • Save almokhtarbr/355a83a727ce65c58e86acd46f063024 to your computer and use it in GitHub Desktop.
Save almokhtarbr/355a83a727ce65c58e86acd46f063024 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
attr_accessor :skip_some_callbacks
before_validation :do_something, unless: :skip_some_callbacks
after_validation :do_something_else, unless: :skip_some_callbacks
end
person = Person.new(person_params)
person.skip_some_callbacks = true
person.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment