This hack is pretty neat, but isn't there any other way to iterate through all the engines other than that? Also, I think this only works if spinach is loaded in the end, am I right?

If that's the case, maybe this code should be initialized someplace here:

https://github.com/codegram/spinach-rails/blob/master/lib/spinach-rails/railtie.rb#L12

There should be a way to be sure we're the last gem to be initialized.

Or did I get something wrong?