diff --git a/lib/dmpopidor/controllers/orgs.rb b/lib/dmpopidor/controllers/orgs.rb index 757304b..0bce662 100644 --- a/lib/dmpopidor/controllers/orgs.rb +++ b/lib/dmpopidor/controllers/orgs.rb @@ -37,14 +37,15 @@ end end - # if active is false, unpublish all published tempaltes - if params[:active] != "1" - p @org.published_templates.update_all(published: false) - end - end if @org.update_attributes(attrs) + + # if active is false, unpublish all published tempaltes + if !@org.active + @org.published_templates.update_all(published: false) + end + redirect_to "#{admin_edit_org_path(@org)}\##{tab}", notice: success_message(@org, _("saved")) else