gui_maranhao
gui_maranhao

Reputation: 81

Avoiding activerecord-session_store access at assets loading

I am using activerecord-session_store gem to manage database session, but the session_store is being accessed at every asset load (.png, .css, .html, .js). Is it normal or is there a way to avoid it? Do I need to implement my own session class to solve this?

Regards,

Guilherme

Upvotes: 1

Views: 136

Answers (1)

Uzbekjon
Uzbekjon

Reputation: 11813

That's because your asset requests are hitting your rails application. But in real case scenario, you have a more efficient user facing server like nginx to handle your static assets. So, in production those request would not be reaching your Rails app and there would be no access to session store.

Having said that, it is strange that the gem is hitting your DB. I guess the authors had to add their middleware quite early in rack chain.

Upvotes: 0

Related Questions