I installed Ruby on Rails 1.9.3 version on windows . I built a simple
hello world program , the issue is that when I build it in sublime text
2 I get this error :"Uninitialized constant ApplicationController (
nameerror) " and I get the same error when run this program in the
command line . My application_controller.rb look like this :
class ApplicationController < ActionController::Base
end
I installed the gems but I still get this error . I downloaded ruby
rails to a mac and having the same issue.
The program :
class HelloworldsController < ApplicationController
def hi
puts “Hello world”
end
end
On Wednesday, September 24, 2014 5:18:49 PM UTC+1, Morad wrote:
Any thoughts pleas ?
sublime text’s build action just runs the current ruby file if my memory
is
correct. You need to run the rails server (bin/rails s) in order to use
your app.
Yes I did create the new project through the command prompt, then
generated a controller for it ( Helloworlds) . I went into the
directory where the project is and started the rail server , tested it
and it comes up on the browser.
While in the folder where the project is, issued command : ruby
helloworlds_conteoller.rb ,then I would get that error . Basically I am
expecting to see the output "hello world " when I run it in the command
prompt and on sublime but I don’t see it.
It sounds like something with the application controller but not sure
what is
Who told you to run ruby helloworlds_conteoller.rb and why would you
expect that output from executing that as a ruby script?
In short, that’s just not how Rails is built. Your webserver starts up
the entire Rails app – including loading all associated files and
dependencies – when you run rails server. (which is sounds like you
already are successfully able to do?)
Running any individual file with the ruby command isn’t how a Rails app
works.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.