From 0247995d05b3cd3ff5fe32d5fbd8fdd866646909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 19 Jun 2010 18:18:45 +0200 Subject: ActiveModel::Validations::Callbacks should not be required by default. --- activerecord/lib/active_record/base.rb | 1 - activerecord/lib/active_record/callbacks.rb | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ef8dbdb6e5..def0fdaa2f 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1874,7 +1874,6 @@ module ActiveRecord #:nodoc: extend ActiveSupport::DescendantsTracker include ActiveModel::Conversion - include ActiveModel::Validations::Callbacks include Validations extend CounterCache include Locking::Optimistic, Locking::Pessimistic diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 42b56a3cf8..997c85ef8c 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -234,8 +234,7 @@ module ActiveRecord included do extend ActiveModel::Callbacks - - attr_accessor :validation_context + include ActiveModel::Validations::Callbacks define_model_callbacks :initialize, :find, :only => :after define_model_callbacks :save, :create, :update, :destroy @@ -249,12 +248,6 @@ module ActiveRecord send(meth.to_sym, meth.to_sym) end end - - end - - def valid?(*) #:nodoc: - self.validation_context = new_record? ? :create : :update - super end def destroy #:nodoc: @@ -269,6 +262,7 @@ module ActiveRecord end private + def create_or_update #:nodoc: _run_save_callbacks { super } end -- cgit v1.2.3