Skip to content

Commit 47062ce

Browse files
committed
Allow for custom version class
This pulls from the current model config (if given) to fetch the appropriate class to look up version history - defaulting to `PaperTrail::Version` when no class is set on a configured model.
1 parent bbbec3f commit 47062ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rails_admin_history_rollback/config/actions/history_index.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class HistoryIndex < Base
2424
proc do
2525
@general = true
2626
@history = @auditing_adapter && @auditing_adapter.listing_for_model(@abstract_model, params[:query], params[:sort], params[:sort_reverse], params[:all], params[:page]) || []
27-
@version = ::PaperTrail::Version.find(params[:version_id]) if params[:version_id] rescue false
27+
version_class = @abstract_model.model.paper_trail_options.dig(:versions, :class_name).try(:constantize) || ::PaperTrail::Version
28+
@version = version_class.find(params[:version_id]) if params[:version_id] rescue false
2829

2930
if request.get? # SHOW
3031

0 commit comments

Comments
 (0)