Skip to content

Rails error: Routing Error: uninitialized constant

Sean Lerner edited this page Apr 12, 2017 · 3 revisions

If your error looks like ...

Routing Error
uninitialized constant ProductsController

... then rails can't find the controller being routed to.

How To Fix

Step 1. Create a controller

Check your app/controllers folder. If you don't see a file for your controller, then use the rails generator to create a controller. For example, from your command line:

rails generate controller products

Replace products with the controller you desire. Note that you likely need to ensure that your controller name is pluralized.

Clone this wiki locally