Rails code that doesn’t get executed for generations and migrations

At work, we’ve developed some plugins that cause issues when invoked in generators. For instance, you may be creating controllers on the fly, and so when you what to generate a controller to override the automatic one, you can’t as it is ‘reserved’.

Well, you can determine what context in which you code is being executed quite easily using built in globals in Ruby.

To elaborate on the boss’s original post

I’d love to wrap this in a nice plugin, patch or gem to enable cool things like this: