chaps-io / access-granted

Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
MIT License
774 stars 41 forks source link

move rails initialization into a railtie #45

Closed ships closed 6 years ago

ships commented 6 years ago

While trying to integrate AccessGranted into a project, I encountered problems it introduced to the load order of some classes, with confusing breakage happening far down the line as a result.

In particular, some rails modules were patching their own logic into ActionController::API, and doing so in a Railtie initializer (I first encountered this with jbuilder) . Once I included AccessGranted in my project, I found that the relevant classes were being loaded before this logic; ultimately, my controller lacked the ActionView::Rendering module.

This PR fixes this issue by migrating that logic into the canonical Railtie format as well for access granted. This has enabled me to load up Jbuilder's initializer first.

pokonski commented 6 years ago

Wow that is a great addition, thanks! I'll test it out and if it works, release as 1.3.0 :)

pokonski commented 6 years ago

@jraqula released as 1.3.0 :boom:

ships commented 6 years ago

@pokonski stellar ! What a fast turnaround you have there ! Thanks.

pokonski commented 6 years ago

It's quiet around here :grin: