This project is archived and is in readonly mode.

#1757 ✓resolved
Matt Jones

Generators don't load gems from environment.rb

Reported by Matt Jones | January 14th, 2009 @ 06:11 AM | in 3.0.2

When using script/generate, the gem settings in environment.rb are not followed.

So for instance, even if version 0.4.0 of a gem is specified in environment.rb, if a higher version is installed, script/generate will end up using it.

Addressing this is going to be painful... we probably don't want to run the whole Initializer block just to pick up these settings. The solution is probably going be part of #1721.

Comments and changes to this ticket

  • Matt Jones

    Matt Jones May 31st, 2009 @ 03:48 AM

    • Tag changed from 2.2-stable, bug, gems, generators to 2-3-stable, 2.2-stable, bug, gems, generators
    • Assigned user changed from “Matt Jones” to “Pratik”

    Attached is a partial solution to this which at least allows generators in frozen gems to be found and used. It adds the VendorGemSourceIndex stuff and searches the specs correctly. The net effect is that generators inside frozen gems will always have priority.

    Again, not complete (it still doesn't handle a specification of a different system-repository gem) but at least a start.

    No tests, as I couldn't figure out an orderly way to test the interaction between a frozen gem and a system-installed gem. That, and there were exactly 0 tests for the existing "load generators from gems" functionality. Suggestions are welcome.

    Patch is against 2-3-stable.

  • José Valim

    José Valim August 10th, 2009 @ 12:15 PM

    • Assigned user changed from “Pratik” to “José Valim”

    Matt, on Rails 3 we are only going to load generators from loaded gems. We hope to offer a more robust solution together with Carlhuda bundler.

  • José Valim

    José Valim January 2nd, 2010 @ 11:29 PM

    • State changed from “new” to “resolved”

    This is fixed on Rails 3.

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by