Skip to content

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

Closed

Description

@catmando

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.

Activity

  1. added this to the alpha1.3 milestone on Jan 2, 2019
  2. added
    ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch
    and removed
    ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch
    on Jan 15, 2019
  3. added a commit that references this issue on Jan 15, 2019
    a2cf2c1
  4. added
    ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch
    on Jan 15, 2019
  5. added a commit that references this issue on Sep 2, 2026
    b7026fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions