While trying to use the oh-so-nifty missing spec finder on a recent project, I discovered that it was not working. Hmmm… seems that somewhere along the way Rails added detection for existing constants and won't allow you to re-generate something. Instead it calls raise_class_collision
, which raises a UsageError
. Damn them.
Anyway, to work around this for now, you can add the following somewhere (e.g., an initializer):
This should get around that inconvenience. Plus, you won't be exposed to nefarious suggestions like I was:
Thanks Rails, you're so helpful! I just don't understand how it could have known I was building a Facebook clone for junkies…
Other Resources
- Rails Ticket #545: Bug colliding classes (when they shouldn't)
- resource_controller Google group: Reserved resource names?
Need web application development, maintenance for your existing app, or a third party code review?
Velocity Labs can help.
Hire us!