lib/active_support/callbacks.rb in activesupport-5.0.0.beta1 vs lib/active_support/callbacks.rb in activesupport-5.0.0.beta1.1

- old
+ new

@@ -69,11 +69,11 @@ # If true, Active Record and Active Model callbacks returning +false+ will # halt the entire callback chain and display a deprecation message. # If false, callback chains will only be halted by calling +throw :abort+. # Defaults to +true+. - mattr_accessor(:halt_and_display_warning_on_return_false) { true } + mattr_accessor(:halt_and_display_warning_on_return_false, instance_writer: false) { true } # Runs the callbacks for the given event. # # Calls the before and around callbacks in the order they were set, yields # the block (if given one), and then runs the after callbacks in reverse @@ -740,10 +740,10 @@ # `!`, `?` or `=`. def define_callbacks(*names) options = names.extract_options! names.each do |name| - class_attribute "_#{name}_callbacks" + class_attribute "_#{name}_callbacks", instance_writer: false set_callbacks name, CallbackChain.new(name, options) module_eval <<-RUBY, __FILE__, __LINE__ + 1 def _run_#{name}_callbacks(&block) __run_callbacks__(_#{name}_callbacks, &block)