Commit f844a5921011a3fa59a3d310e5795474a22498e2

Authored by Andrey Karpikov
1 parent 325d65a5

check duplicate function

@@ -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)
1 module Kanjai 1 module Kanjai
2 - VERSION = "0.0.293" 2 + VERSION = "0.0.294"
3 end 3 end