gazay / gon

Your Rails variables in your JS
MIT License
3.05k stars 184 forks source link

Autoload test classes only in test env #252

Closed wilddima closed 6 years ago

wilddima commented 6 years ago

Hi @gazay!

There are some problems with LiveControllers. When we lookup for this constant, rails will try to autoload it. But ActionController::TestCase patches method of Live instance: new_controller_thread, which creates a new thread for a response to connection, because in the test environment can be problems with database connections. Therefore in the development environment, LiveController works in the same thread, as the main rails thread, so it can't respond by chunks. It just writes all response to buffer, and respond at the end of the action.

So, my solution is just lookup this constant only if Rails in test environment.

gazay commented 6 years ago

Thanks!