Sha256: 304f4c7c1411b134b18b56d660097c05f8c5137ef1d5686eb0560a5fb90b2088
Contents?: true
Size: 763 Bytes
Versions: 31
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim module ResourceVersionsConcern extend ActiveSupport::Concern included do helper Decidim::TraceabilityHelper helper_method :current_version, :versioned_resource def show raise ActionController::RoutingError, "Not found" unless current_version end private # Overwrite this method in your controller to define how to find the # versioned resource. def versioned_resource raise StandardError, "Not implemented" end def current_version return nil unless params[:id].to_i.positive? @current_version ||= versioned_resource.versions[params[:id].to_i - 1] end end end end
Version data entries
31 entries across 31 versions & 1 rubygems