fancyremarker/rabl-generators — pull request #2 by razum2um (2014-03-29 19:57:11+00:00)
Title: Current implementation breaks ModelGenerator

Hi, recently I run into some strange issue - bundling this gem run of `rails generate model SomeModel` produces *nothing*

Here is the explanation & solution

Rails::Generators.configure! is called AFTER run_generators_blocks(app)
inside of here: https://github.com/rails/rails/blob/master/railties/lib/rails/engine.rb#L456

This order causes following:
- require of ResourceGenerator (of this gem) and parent ModelGenerator (of Rails)
- call of 'hook_for' inside ModelGenerator
- freezing of ModelGenerator.class_option to have { orm: false } instead of { orm: :active_record }
because options are yet NOT configured

Afterwards, when Thor commands are running
- here: https://github.com/erikhuda/thor/blob/master/lib/thor/group.rb#L125
options holds old { orm: false } value, which prevents all the orm generators to run
- as such neither model file, nor migrations are generated
- this behavior remains even if you run `rails g model Account` - I added such spec, too

Sorry, but I cannot reproduce this fail otherwise.
I consider this as a Rails bug, but not sure, maybe it's a feature:
ModelGenerator MUST be autoloaded during command run, not required

Beware, that reading is MUCH faster, than debugging this issue :smile: