Wes Nolte
Wes Nolte

Reputation: 866

"Routing Error uninitialized constant" error

I've gone through a number of the causes of this problem but I think that this issue is related to the names I've given my resources. Here's the command I'm running.

rails generate scaffold_controller iform__c content__c:String header__c:String

But when I navigate to:

http://localhost:3000/iform__cs

I get the following error:

Routing Error

uninitialized constant Iform_csController

I've raked the DB, the files all exist so I'm very confused. I've tried exactly the same rails g command for a resource named "account" and it seems to work perfectly.

Would love to know if anyone can explain why I'm getting this error.

Upvotes: 1

Views: 616

Answers (1)

Rob Howard
Rob Howard

Reputation: 1819

Rails uses a bunch of conventions to make things work smoothly. You're breaking pretty much every single one with this naming scheme.

If it's a legacy database you're having to deal with, I suggest using updateable VIEWs to bring the column and table names in line with Rails' expectations.

If it's a legacy URL scheme you're having to deal with, consider creating a clean structure within Rails, and rewrite legacy URLs to the new-style ones with nginx rewrite rules.

(If you're unwilling to do either, Rails may not be the software for you. Zend Framework may provide you with the capability to service tangled Enterprise application structures more easily.)

Upvotes: 2

Related Questions