From 21e7b8462113fc7c0fd1882dcc2bf7225de67b1a Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 12 Oct 2009 22:15:43 -0500 Subject: Callbacks, DeprecatedCallbacks = NewCallbacks, Callbacks --- .../active_record/associations/association_collection.rb | 2 +- activerecord/lib/active_record/callbacks.rb | 4 ++-- .../active_record/connection_adapters/abstract_adapter.rb | 4 ++-- activerecord/lib/active_record/validations.rb | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 1b7bf42b91..25e329c0c1 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -476,7 +476,7 @@ module ActiveRecord def callback(method, record) callbacks_for(method).each do |callback| - ActiveSupport::Callbacks::Callback.new(method, callback, record).call(@owner, record) + ActiveSupport::DeprecatedCallbacks::Callback.new(method, callback, record).call(@owner, record) end end diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 40a25811c4..b25893a1c3 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -20,7 +20,7 @@ module ActiveRecord # * (6) after_save # # That's a total of eight callbacks, which gives you immense power to react and prepare for each state in the - # Active Record lifecycle. The sequence for calling Base#save for an existing record is similar, except that each + # Active Record lifecycle. The sequence for calling Base#save for an existing record is similar, except that each # _on_create callback is replaced by the corresponding _on_update callback. # # Examples: @@ -210,7 +210,7 @@ module ActiveRecord # instead of quietly returning +false+. module Callbacks extend ActiveSupport::Concern - include ActiveSupport::NewCallbacks + include ActiveSupport::Callbacks CALLBACKS = [ :after_initialize, :after_find, :before_validation, :after_validation, diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 78c7a4b697..cdf0aebfee 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -32,7 +32,7 @@ module ActiveRecord class AbstractAdapter include Quoting, DatabaseStatements, SchemaStatements include QueryCache - include ActiveSupport::Callbacks + include ActiveSupport::DeprecatedCallbacks define_callbacks :checkout, :checkin @@row_even = true @@ -75,7 +75,7 @@ module ActiveRecord def supports_ddl_transactions? false end - + # Does this adapter support savepoints? PostgreSQL and MySQL do, SQLite # does not. def supports_savepoints? diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index ab79b520a2..e61b253192 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -59,15 +59,15 @@ module ActiveRecord end # Translates an error message in it's default scope (activerecord.errrors.messages). - # Error messages are first looked up in models.MODEL.attributes.ATTRIBUTE.MESSAGE, if it's not there, - # it's looked up in models.MODEL.MESSAGE and if that is not there it returns the translation of the - # default message (e.g. activerecord.errors.messages.MESSAGE). The translated model name, + # Error messages are first looked up in models.MODEL.attributes.ATTRIBUTE.MESSAGE, if it's not there, + # it's looked up in models.MODEL.MESSAGE and if that is not there it returns the translation of the + # default message (e.g. activerecord.errors.messages.MESSAGE). The translated model name, # translated attribute name and the value are available for interpolation. # # When using inheritance in your models, it will check all the inherited models too, but only if the model itself # hasn't been found. Say you have class Admin < User; end and you wanted the translation for the :blank # error +message+ for the title +attribute+, it looks for these translations: - # + # #
    #
  1. activerecord.errors.models.admin.attributes.title.blank
  2. #
  3. activerecord.errors.models.admin.blank
  4. @@ -80,10 +80,10 @@ module ActiveRecord message, options[:default] = options[:default], message if options[:default].is_a?(Symbol) defaults = @base.class.self_and_descendants_from_active_record.map do |klass| - [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}", + [ :"models.#{klass.name.underscore}.attributes.#{attribute}.#{message}", :"models.#{klass.name.underscore}.#{message}" ] end - + defaults << options.delete(:default) defaults = defaults.compact.flatten << :"messages.#{message}" @@ -104,7 +104,7 @@ module ActiveRecord module Validations extend ActiveSupport::Concern - include ActiveSupport::Callbacks + include ActiveSupport::DeprecatedCallbacks include ActiveModel::Validations included do -- cgit v1.2.3