From 2ffa50f5a9fac08e08869687006031b70322497a Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Fri, 20 Aug 2010 10:17:29 -0400 Subject: after_validation should be called irrespective of the result of validation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I confirmed that this is the behavior on 2.3.x . [5419 state:resolved] Signed-off-by: José Valim --- activemodel/test/models/topic.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activemodel/test/models/topic.rb') diff --git a/activemodel/test/models/topic.rb b/activemodel/test/models/topic.rb index f25b774cd7..ff34565bdb 100644 --- a/activemodel/test/models/topic.rb +++ b/activemodel/test/models/topic.rb @@ -1,7 +1,11 @@ class Topic include ActiveModel::Validations + include ActiveModel::Validations::Callbacks attr_accessor :title, :author_name, :content, :approved + attr_accessor :after_validation_performed + + after_validation :perform_after_validation def initialize(attributes = {}) attributes.each do |key, value| @@ -16,4 +20,9 @@ class Topic def condition_is_true_but_its_not false end + + def perform_after_validation + self.after_validation_performed = true + end + end -- cgit v1.2.3