From d5021fad2c007a6b8e6126c1a555a44e7f91c85d Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Fri, 27 Jan 2017 16:25:11 +0100 Subject: [PATCH 1/2] fix step does not save if table is without content --- app/models/step.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/step.rb b/app/models/step.rb index 3d329096d..42c2a1657 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -35,7 +35,7 @@ class Step < ActiveRecord::Base reject_if: :all_blank, allow_destroy: true accepts_nested_attributes_for :tables, - reject_if: :all_blank, + reject_if: proc { |attributes| attributes['contents'].blank? }, allow_destroy: true after_destroy :cascade_after_destroy From b291553d01fe4c5eccc068c93327c3e0e6ef99d7 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Fri, 27 Jan 2017 16:36:03 +0100 Subject: [PATCH 2/2] fix hound --- app/models/step.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/step.rb b/app/models/step.rb index 42c2a1657..97c17edac 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -29,14 +29,16 @@ class Step < ActiveRecord::Base dependent: :destroy accepts_nested_attributes_for :checklists, - reject_if: :all_blank, - allow_destroy: true + reject_if: :all_blank, + allow_destroy: true accepts_nested_attributes_for :assets, - reject_if: :all_blank, - allow_destroy: true + reject_if: :all_blank, + allow_destroy: true accepts_nested_attributes_for :tables, - reject_if: proc { |attributes| attributes['contents'].blank? }, - allow_destroy: true + reject_if: proc { |attributes| + attributes['contents'].blank? + }, + allow_destroy: true after_destroy :cascade_after_destroy before_save :set_last_modified_by