Commit 3c106e681c68c750db56bcc0e866d86a4bd25f1a
1 parent
9fd17be7
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Prevent error when block has nil position
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/block.rb
... | ... | @@ -230,7 +230,7 @@ class Block < ActiveRecord::Base |
230 | 230 | duplicated_block.created_at = nil |
231 | 231 | duplicated_block.updated_at = nil |
232 | 232 | duplicated_block.save! |
233 | - duplicated_block.insert_at(self.position + 1) | |
233 | + duplicated_block.insert_at((self.position || 0) + 1) | |
234 | 234 | duplicated_block |
235 | 235 | end |
236 | 236 | ... | ... |