1

I'm having a Rails 4 application with database PostgreSQL. I want to store all log changes of topic model in a different database. Is it possible to use secondbase and audited gem together. What is the best way to do it?. I have been trying this for a week with secondbase and audited by modifying the gem. Internally in audited gem i added secondbase and inherited audit module from SecondBase::Base instead of ActiveRecord::Base

shiva
  • 434
  • 4
  • 21

1 Answers1

0

As far as I can see, getting the audited gem to write to a different database is going to be difficult. Any time you need to write to a different database from Rails, you're going to have to manually establish the connection to that database. Given the way audited works, it is going to be hard to achieve this functionality.

Although, why would you want to store the logs in a different db? You need to access the logs through the AR models. So by having them in a different DB, you're introducing unnecessary complexity and maintenance overhead.

Jerry
  • 874
  • 6
  • 15
  • I'm already having a huge database now, I want to move the logs into a different database so that in future and I can maintain that database just for logs for different models. Planning to write a separate service to access the logs from that database. – shiva Mar 15 '16 at 13:54