Showing
2 changed files
with
2 additions
and
2 deletions
| @@ -138,7 +138,7 @@ module Kanjai | @@ -138,7 +138,7 @@ module Kanjai | ||
| 138 | @obj = @page_data.page_contents.find_by_structure_id(@structure_id) | 138 | @obj = @page_data.page_contents.find_by_structure_id(@structure_id) |
| 139 | if @obj | 139 | if @obj |
| 140 | Page.transaction do | 140 | Page.transaction do |
| 141 | - next_structure_id = @page_data.page_contents.pluck(:structure_id).max.to_i + 1 | 141 | + next_structure_id = @page_data.page_contents.where.not(structure_id: nil).pluck(:structure_id).max.to_i + 1 |
| 142 | @new_obj = @obj.dup | 142 | @new_obj = @obj.dup |
| 143 | @new_obj.structure_id = next_structure_id | 143 | @new_obj.structure_id = next_structure_id |
| 144 | @new_obj.save(validate: false) | 144 | @new_obj.save(validate: false) |