uninitialized constant ActionController (NameError)

I'm getting this error when trying to deploy.

/home/ubuntu/workspace/hello_app/app/controllers/application_controller.rb:1:in `<main>': uninitialized constant ActionController (NameError) 

application_controller.rb

 class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def hello render text: "hello, world!" end end 

routes.rb

Rails.application.routes.draw do # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" root 'application#hello' 

I am using Cloud9.

Please help me, I wonder "ActionController::Base" spells miss. But this is correct...

2

2 Answers

I believe you are starting the server using C9's 'run' command. Instead try running your code with this in the C9 terminal (make sure you are in the correct directory):

rails s -b $IP -p $PORT 

A Cloud9 popup should appear that you can click the link to view your code.

2

I think you forgot to run the rails server

Run the rails server command and then preview running application

~/environment/hello_app (master) $ rails server 

Running the Rails server

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like