12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/active_scaffold/bridges/paper_trail/actions.rb', line 12
def deleted
query = PaperTrail::Version.destroys.where(:item_type => active_scaffold_config.model.name)
if nested? && nested.child_association&.belongs_to? && PaperTrail::Version.respond_to?(:where_object)
foreign_key = nested.child_association.foreign_key
parent_id = nested.parent_id
parent_id = parent_id&.to_i if self.class.active_scaffold_config.columns[foreign_key]&.number?
query = query.where_object(foreign_key => parent_id)
end
= Paginator.new(query.count, active_scaffold_config.list.per_page) do |offset, per_page|
query.offset(offset).limit(per_page).map(&:reify)
end
@pagination_action = :deleted
@page = .page(params[:page] || 1)
@records = @page.items
respond_to_action(:list)
end
|