Sha256: 0949654fb078ff45224914eb57271df0223e780044667755f855e625f1eb2130
Contents?: true
Size: 745 Bytes
Versions: 3
Compression:
Stored size: 745 Bytes
Contents
module ActiveAdminVersioning module ActiveAdmin module ResourceController def self.included(base) base.before_action(:set_paper_trail_whodunnit) end def show page = params[:page].to_i @versions = resource.versions.reorder(id: :desc, created_at: :desc).page(params[:page]).per(1) @version_number = page > 0 ? @versions.total_count - (page - 1) : @versions.total_count if @versions.any? && @versions[0].next.present? set_resource_ivar(@versions[0].next.reify) end show! end protected def user_for_paper_trail respond_to?(:current_admin_user) ? current_admin_user.id : t("views.version.unknown_user") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems