#624 ✓wontfix
Betelgeuse

Hobo 0.9.106 breaks loading classes from lib directory

Reported by Betelgeuse | February 12th, 2010 @ 01:44 PM

With 0.9.103:

$ script/console 
Loading development environment (Rails 2.3.5)
>> FoobarThingGenerator
=> FoobarThingGenerator
$ cat lib/foobar_thing_generator.rb 
class FoobarThingGenerator
end

With 0.9.106:

$ script/console 
Loading development environment (Rails 2.3.5)
>> FoobarThingGenerator
Rails::Generator::GeneratorError: Couldn't find 'foobar_thing' generator
    from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails_generator/lookup.rb:135:in `lookup'
    from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails_generator/lookup.rb:13:in `const_missing'
    from (irb):1

Comments and changes to this ticket

  • Bryan Larsen

    Bryan Larsen February 12th, 2010 @ 05:39 PM

    A class ending in Generator is a magic name in Rails. If you're not creating a generator you should use a different name. If you are, /lib is not the best place for these. A class of "Foo" will load fine from /lib.

    The problem is the line require 'rails_generator' in rails/init.rb. Removing that line "fixes" your bug report, but it doesn't fix the underlying problem. It's just changing an initialization order. rails_generator is eventually loaded anyways (it's required for dryml generation, I believe). The difference is that FoobarThingGenerator must have been autoloaded by your program prior to the require of rails_generator.

    I think this is a "wontfix" but I'll let Matt/Tom chime in before marking it so.

  • Bryan Larsen

    Bryan Larsen February 19th, 2010 @ 06:30 PM

    • State changed from “new” to “wontfix”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

Pages