need to force load of all policies when running in non-server environments #97
Labels
bug
Something isn't working
ready-to-release
Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone
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.The text was updated successfully, but these errors were encountered: