Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rail3 will not load generators that are located in gems that are loaded using bundler

#3603

When gems are managed through bundler the Gem module will not respond to the loaded_specs method. This makes it impossible to load generators from the included gems. I patched the generators.rb so that if Gem does not respond to loaded_specs and if Gem.path is not nil to look for generators in the Gem.path directory. I have attached a patch and it would be great if I could get some feedback on it (this is my first patch I have submitted to rails).

Reported by joshsmoore (at gmail) · December 21st, 2009 @ 06:13 AM

State: resolved
Milestone: none
Assigned to: José Valim José Valim
Importance: High

Activity

  1. José Valim
    José Valim
    • State changed from new to open
    • Assigned user set to José Valim

    January 3rd, 2010 @ 12:22 AM

  2. Rizwan Reza
    Rizwan Reza
    • Tag changed from generators, patch, rails3 to generators, patch, rails3, review

    +1 Applies cleanly on master. All tests in railties also pass.

    By the way, I don't know if it really needs tests, but the patch above doesn't include one.

    January 3rd, 2010 @ 03:58 PM

  3. José Valim
    José Valim

    Thanks guys. I just have to check with Yehuda if they plan to support Gem.loaded_specs or I will have to use Gem.path as Josh proposed.

    January 3rd, 2010 @ 04:01 PM

  4. José Valim
    José Valim
    • State changed from open to resolved

    Just have generators in your load path and it will work. If you want to invoke to "script/generate foo", have "generators/foo_generator" in your load path and it will be picked.

    January 20th, 2010 @ 01:58 PM