38 lines
1.4 KiB
Ruby
38 lines
1.4 KiB
Ruby
class SubprincipleitemsController < ApplicationController
|
|
before_action :set_subprincipleitem, only: %i[ edit update ]
|
|
before_action :set_caf, only: %i[ edit update ]
|
|
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
respond_to do |format|
|
|
if @subprincipleitem.update(subprincipleitem_params)
|
|
#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 }
|
|
end
|
|
end
|
|
end
|
|
|
|
private
|
|
def set_subprincipleitem
|
|
@subprincipleitem = Subprincipleitem.find(params[:id])
|
|
end
|
|
|
|
def set_caf
|
|
@caf = Caf.find(params[:caf_id])
|
|
end
|
|
|
|
# Only allow a list of trusted parameters through.
|
|
def subprincipleitem_params
|
|
params.require(:subprincipleitem).permit(:affirmative,:evidence)
|
|
end
|
|
end
|