I'm working on a bug on a rails engine using both paper_trail and acts_as_taggable_on. When I rollback a deleted event the event details are restored, but the tags are not. Has anyone came across this same issue?
Some relevant info:
models/calagaor/event.rb
class Event < ActiveRecord::Base
has_paper_trail
acts_as_taggable
end
I also created a config/initializers/act_as_taggable.rb file:
ActsAsTaggableOn::Tag.class_eval do
has_paper_trail
end
ActsAsTaggableOn::Tagging.class_eval do
has_paper_trail
end
I'm pretty new to rails so I'm not sure if I'm headed in the right direction or not. Let me know if you need more details. Thanks!
Edit:
controllers/calagator/versions_controller.rb
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
self.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
I'm using paper_trail '3.0.8'