Skip to content
This repository has been archived by the owner on Aug 16, 2019. It is now read-only.

Deletion populator and multiple new records #128

Open
wants to merge 1 commit into
base: f6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gems/reform/populator.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ You can implement your own deletion.
collection :songs,
populator: ->(fragment:, **) {
# find out if incoming song is already added.
item = songs.find { |song| song.id.to_s == fragment["id"].to_s }
item = songs.find { |song| song.id.present? && song.id.to_s == fragment["id"].to_s }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #present? method not exist.

1.present?
NoMethodError: undefined method `present?' for 1:Fixnum


if fragment["delete"] == "1"
songs.delete(item)
Expand Down