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

De-couple DescendantLoader from Rails #15460

Closed

Commits on Jun 28, 2017

  1. Adds DescendantLoader.setup

    Adds a setup method to DescendantLoader that will do the monkey patching
    necessary on ActiveRecord and ActiveSupport, but only do it once.
    
    Also moves the module prepending of ActsAsArModel to that class, since
    we own it.  This allows it to be deferred from loading and applying the
    DescendantLoader patches until ActsAsArModel is required/needed.
    NickLaMuro committed Jun 28, 2017
    Configuration menu
    Copy the full SHA
    2ff8f43 View commit details
    Browse the repository at this point in the history
  2. Require ActiveRecord in DescendantLoader

    By requiring ActiveRecord in the DescendantLoader, it allows the .setup
    method to be run by just requiring lib/extensions/descendant_loader.rb.
    
    Without it, a "uninitialized constant DescendantLoader::ActiveRecord"
    error is raised.
    NickLaMuro committed Jun 28, 2017
    Configuration menu
    Copy the full SHA
    84cb87e View commit details
    Browse the repository at this point in the history
  3. Allow DescendantLoader methods to work w/o Rails

    Swapping out `Rails` and using the `ManageIQ` lib allows for the
    DescendantLoader's instance methods to function without Rails, so the
    following now works:
    
       ruby -Ilib -e 'require "extensions/descendant_loader.rb"; DescendantLoader.descendants_paths'
    NickLaMuro committed Jun 28, 2017
    Configuration menu
    Copy the full SHA
    cc17416 View commit details
    Browse the repository at this point in the history