Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need to force load of all policies when running in non-server environments #97

Closed
catmando opened this issue Jan 2, 2019 · 0 comments
Closed
Labels
bug Something isn't working ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone

Comments

@catmando
Copy link
Contributor

catmando commented Jan 2, 2019

If for example you have a rake task that adds a new record to a model, then at the time the rake task runs all policies may not be loaded, and thus broadcasts resulting from the rake task may not be sent.

This does not occur on the server since the first request from the client needs the value of ActiveRecord::Base.public_columns_hash, and this method forces all models to load, which will force all related policies to load.

However in non-server environments this "first request" is never made and hence models not yet loaded will not have policies.

Solution seems to be to have someplace in HyperModel server side initialization to run ActiveRecord::Base.public_columns_hash (instead of waiting for the first request)

Alternatively it might be nice to tie this to the first after_commit call if the code is NOT running on the server. This would insure the timing is similar for server and non-server environments, but its not clear its necessary.

Work Around:

adding ActiveRecord::Base.public_columns_hash at the end of the hyperstack.rb initializer file (outside the configuration block) seems to work fine.

@catmando catmando added the bug Something isn't working label Jan 2, 2019
@catmando catmando added this to the alpha1.3 milestone Jan 2, 2019
@catmando catmando added ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch and removed ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch labels Jan 15, 2019
@catmando catmando added the ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch label Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Projects
None yet
Development

No branches or pull requests

1 participant