Search code examples
ruby-on-rails-3scaffolding

rails 3.1 scaffold generator broke for project, just stopped working: no such file to load -- rails_generator (LoadError)


SOLVED, see comment below, discovered 'enumerated_attribute' gem breaks rails scaffold

My rails 3.1 scaffolding just broke for my project. (scaffolding still works fine in my other 3.0 and 3.1 projects-- only one project has a broken scaffold generator!)

In my rail 3.1 project, I have scaffolded multiple models the past few days, then today out of the blue rails g scaffold Mymodel is failing with the error message:

/Users/johndoe/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': no such file to load -- rails_generator (LoadError)

I didn't switch rails versions mid-way or anything, the project has always been rails 3.1.3, and it's been working fine until I tried it again today for a new model.

Does anyone have any idea how to fix it and/or what might have caused it to suddenly break?

(rails g migration works fine... it's just scaffolding that is broken!)


Solution

  • Solved. Here is the fix:

    1. Comment out enumerated_attribute gem in the Gemfile
    2. Do scaffolding
    3. Replace enumerated_attribute gem in the Gemfile.