aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/pirate.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/pirate.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/pirate.rb')
-rw-r--r--activerecord/test/models/pirate.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb
index b0490f754e..0d3f62bb33 100644
--- a/activerecord/test/models/pirate.rb
+++ b/activerecord/test/models/pirate.rb
@@ -34,6 +34,8 @@ class Pirate < ActiveRecord::Base
:after_remove => proc {|p,b| p.ship_log << "after_removing_proc_bird_#{b.id}"}
has_many :birds_with_reject_all_blank, :class_name => "Bird"
+ has_one :bulb, :foreign_key => :car_id
+
accepts_nested_attributes_for :parrots, :birds, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
accepts_nested_attributes_for :ship, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
accepts_nested_attributes_for :update_only_ship, :update_only => true