Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Rails generator list -- hides exceptions that might occur while loading generators #6217

mindscratch opened this Issue · 2 comments

2 participants


Today I was creating a generator for a Rails 3.1.3 application and when I ran "rails g" I didn't see it listed. After a little while digging around I realized I had a syntax error in my generator (I forgot to put an "end" to close a method definition).

I then dug into Rails to find out where the code lives for listing the available generators and I found in the generators railtie. Specifically the "lookup!" method.

Notice it tries to require the generators, if an exception occurs it silently ignores it. As a developer, who makes mistakes and didn't have tests for my generator, I would have loved if Rails would have logged a warning when listing the generators.

I'm forking Rails now to offer a potential solution.


Ok, so the version of Rails I looked at work didn't have what I now see in master (which makes sense). perhaps the "help" method in the generators railtie could call "lookup" instead of "lookup!", since "lookup" will raise exceptions.

@schneems schneems referenced this issue from a commit in schneems/rails
@schneems schneems [close #6217] Warn when generator cannot load
If a generator has an error we should display that error rather than swallowing it while allowing other generator sot be listed. This is useful while developing a generator.

Due to the situation with #7606, I'm giving this a close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.