diff --git a/app/models/merged/card.rb b/app/models/merged/card.rb index d78c32f..4ba0573 100644 --- a/app/models/merged/card.rb +++ b/app/models/merged/card.rb @@ -41,7 +41,8 @@ module Merged def delete_and_reset_index delete_save! section.reset_index - save + Section.find(section_id).reset_index + Card.save_all end def self.new_card(card_template , section_id , index) diff --git a/app/models/merged/section.rb b/app/models/merged/section.rb index 7f38d6a..626d786 100644 --- a/app/models/merged/section.rb +++ b/app/models/merged/section.rb @@ -78,8 +78,8 @@ module Merged def delete_and_reset_index delete - page.reset_index - save + Page.find(page_id).reset_index + Section.save_all end def self.new_section(template , page_id , index) diff --git a/test/models/card_write_test.rb b/test/models/card_write_test.rb index 66483d6..5eb6bb0 100644 --- a/test/models/card_write_test.rb +++ b/test/models/card_write_test.rb @@ -16,7 +16,7 @@ module Merged section = first.section index = first.index first.delete_and_reset_index - assert_equal index , section.cards.second.index + assert_equal index , section.cards.first.index end def test_adds @@ -25,6 +25,5 @@ module Merged assert_equal "NEW" , card.header end - end end