Skip to content

Commit 874c1e0

Browse files
Merge pull request #18 from danmurphy1217/fix-add-row-method
.add_row updates
2 parents 89dfc6a + 81fbc0c commit 874c1e0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/notion_api/notion_types/collection_view_blocks.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def add_row(data)
5757
]
5858

5959
data.keys.each_with_index do |col_name, j|
60-
child_component = Utils::CollectionViewComponents.insert_data(new_block_id, j.zero? ? "title" : col_map[col_name], data[col_name], j.zero? ? schema["title"]["type"] : schema[col_map[col_name]]["type"])
60+
unless col_map.keys.include?(col_name.to_s); raise ArgumentError, "Column '#{col_name.to_s}' does not exist." end
61+
child_component = Utils::CollectionViewComponents.insert_data(new_block_id, col_map[col_name.to_s], data[col_name], schema[col_map[col_name.to_s]]["type"])
6162
operations.push(child_component)
6263
end
6364

0 commit comments

Comments
 (0)