aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-10-07 23:50:30 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-10-07 23:50:30 +0100
commit572323135f235cc43e8a5bbafa3a634b4ec71ba8 (patch)
tree69782afc2de5b999d550c8a7bfc21420e06d73c0 /activerecord/test/models
parent9415935902f120a9bac0bfce7129725a0db38ed3 (diff)
downloadrails-572323135f235cc43e8a5bbafa3a634b4ec71ba8.tar.gz
rails-572323135f235cc43e8a5bbafa3a634b4ec71ba8.tar.bz2
rails-572323135f235cc43e8a5bbafa3a634b4ec71ba8.zip
Allow accepts_nested_attributes_for :reject_if option accept symbols for using a method
Conflicts: activerecord/lib/active_record/nested_attributes.rb
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/pirate.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb
index 3d7c4bc48a..05c5b666ae 100644
--- a/activerecord/test/models/pirate.rb
+++ b/activerecord/test/models/pirate.rb
@@ -45,6 +45,10 @@ class Pirate < ActiveRecord::Base
@ship_log ||= []
end
+ def reject_empty_ships_on_create(attributes)
+ attributes.delete('_reject_me_if_new').present? && new_record?
+ end
+
private
def log_before_add(record)
log(record, "before_adding_method")