Sha256: 86b5121fdd73a3a1ae432970ef6eb3405ef81af447b3968f0c151a48e6660cc3
Contents?: true
Size: 686 Bytes
Versions: 7
Compression:
Stored size: 686 Bytes
Contents
# frozen_string_literal: true module Calagator class VersionsController < Calagator::ApplicationController def edit @version = PaperTrail::Version.find(params[:id]) @record = @version.next.try(:reify) || @version.item || @version.reify singular = @record.class.name.singularize.underscore.split("/").last plural = @record.class.name.pluralize.underscore.split("/").last instance_variable_set("@#{singular}", @record) if request.xhr? render partial: "calagator/#{plural}/form", locals: {singular.to_sym => @record} else render "calagator/#{plural}/edit", locals: {singular.to_sym => @record} end end end end
Version data entries
7 entries across 7 versions & 2 rubygems