mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Removing unnecessary code [#5192 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
@@ -377,10 +377,6 @@ module ActiveRecord
|
||||
if association.updated?
|
||||
association_id = association.send(reflection.options[:primary_key] || :id)
|
||||
self[reflection.primary_key_name] = association_id
|
||||
# TODO: Removing this code doesn't seem to matter...
|
||||
if reflection.options[:polymorphic]
|
||||
self[reflection.options[:foreign_type]] = association.class.base_class.name.to_s
|
||||
end
|
||||
end
|
||||
|
||||
saved if autosave
|
||||
|
||||
@@ -171,7 +171,7 @@ class TestDefaultAutosaveAssociationOnAHasOneAssociation < ActiveRecord::TestCas
|
||||
end
|
||||
|
||||
class TestDefaultAutosaveAssociationOnABelongsToAssociation < ActiveRecord::TestCase
|
||||
fixtures :companies
|
||||
fixtures :companies, :posts, :tags, :taggings
|
||||
|
||||
def test_should_save_parent_but_not_invalid_child
|
||||
client = Client.new(:name => 'Joe (the Plumber)')
|
||||
@@ -312,6 +312,12 @@ class TestDefaultAutosaveAssociationOnABelongsToAssociation < ActiveRecord::Test
|
||||
assert_equal num_orders +1, Order.count
|
||||
assert_equal num_customers +2, Customer.count
|
||||
end
|
||||
|
||||
def test_store_association_with_a_polymorphic_relationship
|
||||
num_tagging = Tagging.count
|
||||
tags(:misc).create_tagging(:taggable => posts(:thinking))
|
||||
assert_equal num_tagging +1, Tagging.count
|
||||
end
|
||||
end
|
||||
|
||||
class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCase
|
||||
|
||||
Reference in New Issue
Block a user