HeavyTechRuby/history

View on GitHub
app/controllers/concerns/crud_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module CrudHelper
  extend ActiveSupport::Concern

  private

  def update_record(record, params, redirect_url)
    respond_to do |format|
      if record.update(params)
        format.html { redirect_to redirect_url, notice: t("helpers.crud.update_success") }
        format.json { render :show, status: :ok, location: record }
      else
        format.html { render :edit, status: :unprocessable_entity }
        format.json { render json: record.errors, status: :unprocessable_entity }
      end
    end
  end
end