Skip to content

Commit 0777648

Browse files
committed
Revert "Fix record lookup when id is given as string"
This reverts commit 036713f.
1 parent 036713f commit 0777648

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

lib/active_type/nested_attributes/association.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def derive_class_name
9797
end
9898

9999
def fetch_child(parent, id)
100-
assigned = assigned_children(parent).detect { |r| r.id.to_s == id.to_s }
100+
assigned = assigned_children(parent).detect { |r| r.id == id }
101101
return assigned if assigned
102102

103103
if child = find_scope(parent).find_by_id(id)

spec/active_type/nested_attributes_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,6 @@ def should_assign_and_persist(assign, persist = assign)
235235
should_assign_and_persist(["existing 1", "updated", "existing 3"])
236236
end
237237

238-
it 'allows the id to be given as a string' do
239-
subject.records = [
240-
NestedAttributesSpec::Record.new(:persisted_string => "existing 1"),
241-
NestedAttributesSpec::Record.new(:persisted_string => "existing 2"),
242-
]
243-
subject.records[0].id = 100
244-
subject.records[1].id = 101
245-
246-
subject.records_attributes = { '1' => { 'id' => '101', 'persisted_string' => 'updated' } }
247-
248-
should_assign_and_persist(["existing 1", "updated"])
249-
end
250-
251238
it 'does not update records matching a reject_if proc' do
252239
extra_options.merge!(:reject_if => :bad)
253240
subject.records = [

0 commit comments

Comments
 (0)