I'm trying to log the change events of a model in a separate database using papertrail.
I'm using Rails 4.1.2
Ruby 2.1
Papertrail 4.0.0
Below is the code i have added in concerns
module Foo
class Base < ActiveRecord::Base
end
class Version < Base
include PaperTrail::VersionConcern
end
class Topic < Base
has_paper_trail class_name: 'Foo::Version'
end
end
Foo::Base.establish_connection(:trail_development)
I have included this Foo in topic.rb
class Topic < ActiveRecord::Base
include Foo
end
Whats wrong?
After looking at some of the tests
within the paper_trail
gem I found an example spec
that tests what you are trying to achieve: https://github.com/airblade/paper_trail/blob/v3.0.0/spec/support/alt_db_init.rb