rails-disco icon indicating copy to clipboard operation
rails-disco copied to clipboard

The initialization procedure of projection server may not working with rails plugins

Open laseryuan opened this issue 10 years ago • 3 comments

I have a User model with Devise enabled. It can be loaded properly by rails server but not by the projectionserver. I found the initializer of Devise must be run before the User model is required. It seems that projection server is not running any initializers in the config folder. I could not find a way to get around this yet.

laseryuan avatar Jun 10 '15 15:06 laseryuan

Your observation is correct. The projection server will not perform any initializers.

I have never tried to get something like Devise to run. But my approach would be to use it only on the Rails servers with the command "models". On the projection side everything is done already and should be part of the events.

arBmind avatar Jun 10 '15 18:06 arBmind

Projection server and Rails server share the same model definitions and database. Did you suggest I need to decouple the User model with the other models and only load those models in projectionserver? But that will introduce additional overhead of keeping models separated.

My understanding is that the projection server is the "daemon" side of rails server, it realize the business logic part. They share the same resources, which brings the simplicity of this framework.

laseryuan avatar Jun 11 '15 02:06 laseryuan

I cannot give you any advice, I simply have never tried it. I wish you good luck and I am keen to get to know whether you get it to work or not.

If you have to run some initializers in the projection server try it.

arBmind avatar Jun 13 '15 06:06 arBmind