views:

202

answers:

2

It seems to me that it is possible to break ruby on rails such that neither scaffolding works anymore nor database migration when particular model names are used.

In particular I noticed this when using "Dispatcher" for a model to be created via scaffold. If I created the same object with a different name everything works fine.

Has anybody made similar experiences, or is there a list of names not to be used?

Thanks

+6  A: 

Official list of reserved words in Rails: http://wiki.rubyonrails.org/rails/pages/reservedwords

"dispatcher" is listed under "Other Names Reported to Have Caused Trouble"

Hope that helps :)

Al
Thanks a lot this answer helps me a lot
txwikinger
+2  A: 

Dispatcher is a class defined by Rails under ActionController - so you're hitting a conflict with the Rails class.

In a Rails console:

>> Dispatcher
=> ActionController::Dispatcher

If you want to use the class name Dispatcher you can namespace it in a Module although it is probably better not to use a name that conflicts with a base Rails class.

paulthenerd
Thanks for this answer. This is certainly an interesting idea for the future.
txwikinger