From d8074f4b624f367d42d66e07609c39a41ca56db2 Mon Sep 17 00:00:00 2001 From: Jez Caudle Date: Wed, 4 Dec 2024 17:55:36 +0000 Subject: [PATCH] Spent too long with this. --- app/controllers/subprincipleitems_controller.rb | 8 ++++++-- app/views/subprincipleitems/update.html.erb | 1 + test/models/caf_test.rb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 app/views/subprincipleitems/update.html.erb diff --git a/app/controllers/subprincipleitems_controller.rb b/app/controllers/subprincipleitems_controller.rb index 4da584f..1afd8e9 100644 --- a/app/controllers/subprincipleitems_controller.rb +++ b/app/controllers/subprincipleitems_controller.rb @@ -8,8 +8,12 @@ class SubprincipleitemsController < ApplicationController def update respond_to do |format| if @subprincipleitem.update(subprincipleitem_params) - format.html { redirect_to (company_caf_path(@caf.company, @caf) + "#subprincipleitem_#{@subprincipleitem.id}"), notice: "CAF item was updated." } - format.json { render :show, status: :ok, location: @company } + #redirect_path = helpers.raw("#{company_caf_path(@caf.company, @caf)}/bollox") + #format.html { redirect_to company_caf_path(@caf.company, @caf) , html_options: { target: helpers.dom_id(@subprincipleitem) } , notice: "html" } + ##{company_caf_path(@caf.company, @caf)}#subprincipleitem_#{@subprincipleitem.id} #{helpers.dom_id(@subprincipleitem)} + + #format.json { render :show, status: :ok, location: @company } + format.html { render :update } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @company.errors, status: :unprocessable_entity } diff --git a/app/views/subprincipleitems/update.html.erb b/app/views/subprincipleitems/update.html.erb new file mode 100644 index 0000000..42d40b1 --- /dev/null +++ b/app/views/subprincipleitems/update.html.erb @@ -0,0 +1 @@ +Bollox diff --git a/test/models/caf_test.rb b/test/models/caf_test.rb index b6f9c7a..8ab6af0 100644 --- a/test/models/caf_test.rb +++ b/test/models/caf_test.rb @@ -14,6 +14,6 @@ class CafTest < ActiveSupport::TestCase end test "yaml file is valid" do - ymal = YAML.load_file('config/caf_text.yml') + ymal = YAML.load_file('config/caf_text.yml ') end end