0

Started working with RoR again! I'm having trouble getting my config/routes.rb file to perform. I'm getting "uninitialized constant ApplicationsController" using RubyMine.

Here's what I have changed in my routes.rb after trying to search things down:

resources :applications  
root :to => 'applications#index'

application_controller.rb has:
  class ApplicationController < ActionController::Base
  protect_from_forgery
end

I've ran my rake routes:

    applications GET    /applications(.:format)          applications#index
                 POST   /applications(.:format)          applications#create
 new_application GET    /applications/new(.:format)      applications#new
edit_application GET    /applications/:id/edit(.:format) applications#edit
     application GET    /applications/:id(.:format)      applications#show
                 PUT    /applications/:id(.:format)      applications#update
                 DELETE /applications/:id(.:format)      applications#destroy
            root        /                                applications#index

rake rails:update and all changes were approved except altering routes.rb Heres what its kicks out Rubymine side:

Started GET "/" for 127.0.0.1 at 2012-11-11 02:50:27 -0800
Connecting to database specified by database.yml

ActionController::RoutingError (uninitialized constant ApplicationsController):

Thanks for the help!

Chris Salzberg
  • 27,099
  • 4
  • 75
  • 82
Matt
  • 559
  • 6
  • 15
  • 27

2 Answers2

1

You should rename application_controller.rb to applications_controller.rb

Benjamin Tan Wei Hao
  • 9,621
  • 3
  • 30
  • 56
  • Hmmm plurality issue with the naming of a file? or Generating issue? – Matt Nov 11 '12 at 20:11
  • @Matt In rails this is know as *convention over configuration*. By default all controllers must be pluralized. Model: User Controller: UsersController – Vojtěch Pešek Jul 05 '17 at 13:54
0

Check if you have a file called applications_controller in your app/controller folder, or its name is application_controller, so rename it to applications_controller, if you don't have that file, then create your ApplicationsController:

rails generate controller applications

Thanh
  • 8,219
  • 5
  • 33
  • 56
  • Ended up having to generate a brand new controller called applications_controller.rb. Thanks – Matt Nov 11 '12 at 20:13