aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/bulb.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-23 21:29:36 +0000
committerJon Leighton <j@jonathanleighton.com>2011-01-30 11:56:41 +0000
commit63c73dd0214188dc91442db538e141e30ec3b1b9 (patch)
treede4c6b5a24c40b6e8f1b6d99b425a4bca77bf070 /activerecord/test/models/bulb.rb
parent8adfede96e269ec51f3c52e4e33c8ac63516d546 (diff)
downloadrails-63c73dd0214188dc91442db538e141e30ec3b1b9.tar.gz
rails-63c73dd0214188dc91442db538e141e30ec3b1b9.tar.bz2
rails-63c73dd0214188dc91442db538e141e30ec3b1b9.zip
We shouldn't be using scoped.scoping { ... } to build associated records, as this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved]
Diffstat (limited to 'activerecord/test/models/bulb.rb')
-rw-r--r--activerecord/test/models/bulb.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/test/models/bulb.rb b/activerecord/test/models/bulb.rb
index 9eefc5803a..7178bb0d00 100644
--- a/activerecord/test/models/bulb.rb
+++ b/activerecord/test/models/bulb.rb
@@ -1,7 +1,14 @@
class Bulb < ActiveRecord::Base
-
+
default_scope :conditions => {:name => 'defaulty' }
-
+
belongs_to :car
+ attr_reader :scoped_methods_after_initialize
+
+ after_initialize :record_scoped_methods_after_initialize
+ def record_scoped_methods_after_initialize
+ @scoped_methods_after_initialize = self.class.scoped_methods.dup
+ end
+
end