aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gillard <paulmgillard@gmail.com>2010-06-23 21:36:02 +0100
committerJosé Valim <jose.valim@gmail.com>2010-06-23 22:42:17 +0200
commit4a0a640d33e1c729d38c6091bb1394fbda059b5c (patch)
treece64f479705204b0c484547c2c2be33771b213e4
parent49f52c3d910c8f183afc3a54ea2ae9667f23085e (diff)
downloadrails-4a0a640d33e1c729d38c6091bb1394fbda059b5c.tar.gz
rails-4a0a640d33e1c729d38c6091bb1394fbda059b5c.tar.bz2
rails-4a0a640d33e1c729d38c6091bb1394fbda059b5c.zip
Remove incorrect comment regarding #initialize_copy
Comment added in #3164 is incorrect after reading http://dev.rubyonrails.org/ticket/7191. Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r--activerecord/lib/active_record/base.rb8
1 files changed, 0 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 3a7db97a6a..7a262ad465 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1413,14 +1413,6 @@ module ActiveRecord #:nodoc:
# as it copies the object's attributes only, not its associations. The extent of a "deep" clone is
# application specific and is therefore left to the application to implement according to its need.
def initialize_copy(other)
- # Think the assertion which fails if the after_initialize callback goes at the end of the method is wrong. The
- # deleted clone method called new which therefore called the after_initialize callback. It then went on to copy
- # over the attributes. But if it's copying the attributes afterwards then it hasn't finished initializing right?
- # For example in the test suite the topic model's after_initialize method sets the author_email_address to
- # test@test.com. I would have thought this would mean that all cloned models would have an author email address
- # of test@test.com. However the test_clone test method seems to test that this is not the case. As a result the
- # after_initialize callback has to be run *before* the copying of the attributes rather than afterwards in order
- # for all tests to pass. This makes no sense to me.
callback(:after_initialize) if respond_to_without_attributes?(:after_initialize)
cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
cloned_attributes.delete(self.class.primary_key)