cattr_accessor and Thread.current prblems

I suspect the problem is that in development the model that uses default_scope is only needed at the point that it is used, and at that point App.app_id will have been set. In production however all your models are loaded up front. Depending on when/how you set app_id, the model be setting up its default scope before you sett App.app_id. You could try using the lambda form of default_scope (personally I’ve always found default scope to be tricky to work with)