public-activity / public_activity

Easy activity tracking for models - similar to Github's Public Activity

Home Page:https://github.com/pokonski/public_activity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gem requires db connection during assets precompile

vitaliel opened this issue · comments

I'm trying to build a docker image with instructions from https://blog.wildcat.io/2019/06/rails-with-docker-part-1/

But I have problems because of public_activity gem during assets precompile stage.

Rake task needs routes.rb, routes with devise(User, AdminUser are tracked PublicActivity::Model) needs to access model. I disabled tracking, but other problems appear because of ActiveAdmin which also needs to add routes based on models defined in app/admin/, for example a tracked Page model . The same error appears.

Few stack traces: https://www.pastiebin.com/5f08a8a0b300f https://www.pastiebin.com/5f08a8f33c7c5

I could build docker image by disabling tracking in all models. Maybe there can be a settings to disable db access during assets precompile stage. Thanks.

I was having this problem (not with this gem) a few time ago

haven't tried if this solution is compatible with public_activity , maybe this could work :

Stack overflow answer : rake assets:precompile attempting to connect to database

config.assets.initialize_on_precompile = false
commented

I was having this problem (not with this gem) a few time ago

haven't tried if this solution is compatible with public_activity , maybe this could work :

Stack overflow answer : rake assets:precompile attempting to connect to database

config.assets.initialize_on_precompile = false

I'm pretty sure the initialize_on_precompile option was removed after rails 4. I believe there is something else going on here.

commented

As additional infomation, I find this is only happening when using rails v6.1 and does not happen in rails 6. Any ideas?

commented

Aha, was caused by ArthurWD@8604a95 and went away when using @ArthurWD's rails-6.1 branch

commented

Looks like public activity does not support rails-6.1 yet. @ArthurWD is your rails-6.1 branch functional? Would you be willing to make a PR?

Would this commit also make sense:

shakacode@dbde661

image

Having the same issue in Rails 7 using ledermann's fork. The commit that @justin808 mentions fixes it for me.

Fired up a PR based on the shakacode commit ☝️, maybe it will help

Nice! I was able to go back to the official gem from my own fork.. thanks a lot!