Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "context in validation goes through has many relationship"

This reverts commit 5e3d466.
  • Loading branch information...
commit 621633a6873f35370357183a9b5fd499417327e0 1 parent 942f328
@tenderlove tenderlove authored
View
2  activerecord/lib/active_record/autosave_association.rb
@@ -301,7 +301,7 @@ def validate_collection_association(reflection)
def association_valid?(reflection, record)
return true if record.destroyed? || record.marked_for_destruction?
- unless valid = record.valid?(self.validation_context)
+ unless valid = record.valid?
if reflection.options[:autosave]
record.errors.each do |attribute, message|
attribute = "#{reflection.name}.#{attribute}"
View
10 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -22,8 +22,6 @@
require 'models/categorization'
require 'models/minivan'
require 'models/speedometer'
-require 'models/pirate'
-require 'models/ship'
class HasManyAssociationsTestForReorderWithJoinDependency < ActiveRecord::TestCase
fixtures :authors, :posts, :comments
@@ -1832,12 +1830,4 @@ def test_collection_association_with_private_kernel_method
end
end
end
-
- test 'has_many_association passes context validation to validate children' do
- pirate = FamousPirate.new
- pirate.famous_ships << ship = FamousShip.new
- assert_equal true, pirate.valid?
- assert_equal false, pirate.valid?(:conference)
- assert_equal "can't be blank", ship.errors[:name].first
- end
end
View
8 activerecord/test/models/pirate.rb
@@ -85,11 +85,3 @@ def log(record, callback)
class DestructivePirate < Pirate
has_one :dependent_ship, :class_name => 'Ship', :foreign_key => :pirate_id, :dependent => :destroy
end
-
-class FamousPirate < ActiveRecord::Base
- self.table_name = 'pirates'
-
- has_many :famous_ships
-
- validates_presence_of :catchphrase, on: :conference
-end
View
8 activerecord/test/models/ship.rb
@@ -17,11 +17,3 @@ def cancel_save_callback_method
false
end
end
-
-class FamousShip < ActiveRecord::Base
- self.table_name = 'ships'
-
- belongs_to :famous_pirate
-
- validates_presence_of :name, on: :conference
-end
Please sign in to comment.
Something went wrong with that request. Please try again.