I am fairly new to ruby on rails, and I come across this tutorial on
treehouse where they help you make a simple version of facebook.
anyway, I was writing codes, and I came across this error and I am not
sure how to fix it. The error occurs after I type in rail s on the
command prompt and as soon as try to look at how it looks on
127.0.0.1:3000, it gives me this error. the picture is attached since
its a pretty big error.
I checked out config.rb but i wasn’t sure what i was looking for.
Have you installed all the required gems for your application
try using ‘bundle install’ command and try again
Check your config->routes.rb any uninitialized controller or action
you
may added.
Check your database connection whether your database exist and
credentials are right one in database.yml file.
Thanks,
Senthil
Thanks for the reply. I have done the first two, and it is still not
working. I am not sure what you mean by checking the database
connection. How do i go about doing that?
Best just to copy and paste errors into here so that we can read and
comment on them more easily.
Can you post your config.ru file please. It seems to be the only bit
of the trace that relates directly to your code.
I did ask that you copy and paste here, I am suffering from eye strain
trying to read the image and one cannot cursor down it to aid
following it. I don’t know whether it will help but can you post
config/environment.rb
I did ask that you copy and paste here, I am suffering from eye strain
trying to read the image and one cannot cursor down it to aid
following it. I don’t know whether it will help but can you post
config/environment.rb
Another question, if you make a new app and just do the minimum to get
it to start do you have the same problem?
Best just to copy and paste errors into here so that we can read and
comment on them more easily.
Can you post your config.ru file please. It seems to be the only bit
of the trace that relates directly to your code.
Colin
here is the config.ru file and I attached a picture of the error i get.
This file is used by Rack-based servers to start the application.
require ::File.expand_path(‘…/config/environment’, FILE)
run StoryTime::Application
I did ask that you copy and paste here, I am suffering from eye strain
trying to read the image and one cannot cursor down it to aid
following it. I don’t know whether it will help but can you post
config/environment.rb
Colin
config/environment.rb
Load the rails application
require File.expand_path(‘…/application’, FILE)
Initialize the rails application
Storytime::Application.initialize!
I’m not entirely sure how to paste images onto here. I’m a newcomer so.
but the error is pretty much this:
C:\Sites\storytime>rails s
=> Booting WEBrick
=> Rails 3.2.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Sites/storytime/config.ru:5:in block in <main>': uninitialized constant Stor yTime (NameError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib /rack/builder.rb:51:in instance_eval’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib
/rack/builder.rb:51:in initialize' from C:/Sites/storytime/config.ru:1:in new’
from C:/Sites/storytime/config.ru:1:in <main>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib /rack/builder.rb:40:in eval’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib
/rack/builder.rb:40:in parse_file' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib /rack/server.rb:200:in app’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
/lib/rails/commands/server.rb:46:in app' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib /rack/server.rb:301:in wrapped_app’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib
/rack/server.rb:252:in start' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands/server.rb:70:in start’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
/lib/rails/commands.rb:55:in block in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:50:in tap’
from
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
/lib/rails/commands.rb:50:in <top (required)>' from script/rails:6:in require’
from script/rails:6:in `’
config/environment.rb
Storytime::Application.initialize!
There is the clue, notice this is Storytime not StoryTime. Have you
changed some of them manually? Search the whole directory structure
for storytime, case insensitive, and make sure they are all the same.
I’m not entirely sure how to paste images onto here. I’m a newcomer so.
but the error is pretty much this:
I don’t know how you would copy from a terminal in windows. Perhaps
Edit > Copy. In linux you can use Ctrl-Shift-C.
Colin
I honestly haven’t changed anything of the sort. it was working find
the other day.
One thing tho, I had to change my motherboard on my laptop, could that
have changed anything?
config/environment.rb
Storytime::Application.initialize!
There is the clue, notice this is Storytime not StoryTime. Have you
changed some of them manually? Search the whole directory structure
for storytime, case insensitive, and make sure they are all the same.
I’m not entirely sure how to paste images onto here. I’m a newcomer so.
but the error is pretty much this:
I don’t know how you would copy from a terminal in windows. Perhaps
Edit > Copy. In linux you can use Ctrl-Shift-C.
but the error is pretty much this:
have changed anything?
Are you asking whether changing the mother board could have changed
the text in some of your files on disk?
More importantly you have not said whether, having found and corrected
those that are wrong, does it now work?
I assume you are using a Version Control System such as git. If not
then you should be. Then you can look back through the history to
find when changes were made.
but the error is pretty much this:
have changed anything?
Are you asking whether changing the mother board could have changed
the text in some of your files on disk?
More importantly you have not said whether, having found and corrected
those that are wrong, does it now work?
I assume you are using a Version Control System such as git. If not
then you should be. Then you can look back through the history to
find when changes were made.
Colin
Well honestly, it was working before the change of motherboard, and
after it now it doesn’t work. I haven’t made any changes. It still
doesn’t work, I have done everything that everyone has said except for
the one where you try to check your database connection. I don’t know
how to check my database connection. And yes I do use git.
I assume you are using a Version Control System such as git. If not
then you should be. Then you can look back through the history to
find when changes were made.
Colin
Well honestly, it was working before the change of motherboard, and
after it now it doesn’t work. I haven’t made any changes. It still
doesn’t work, I have done everything that everyone has said except for
the one where you try to check your database connection. I don’t know
how to check my database connection. And yes I do use git.
So you have searched the directory and looked for all references to
storytime (case insensitive) and made them so they are all StoryTime
(if that is what you want) and not Storytime or anything similar
(which is what you said you had in environment.rb). I am surprised it
ever worked with that. Another critical one will be the module
definition in config/application.rb.
doesn’t work, I have done everything that everyone has said except for
Colin
I mean the only place i know that has storytime is the config.ru Ive
never manually changed the name to all case insensitive either.
changing it to Storytime instead of StoryTime wouldn’t let me run rails
s. I looked through all the changes I have made with git status and
looked through the files that I changed but there are not storytime that
i changed.
I don’t seem to be getting through here, let us try another tack.
Please copy and paste here the contents of config.ru,
config/environment.rb and config/application.rb
I assume you are using a Version Control System such as git. If not
then you should be. Then you can look back through the history to
find when changes were made.
Colin
Well honestly, it was working before the change of motherboard, and
after it now it doesn’t work. I haven’t made any changes. It still
doesn’t work, I have done everything that everyone has said except for
the one where you try to check your database connection. I don’t know
how to check my database connection. And yes I do use git.
So you have searched the directory and looked for all references to
storytime (case insensitive) and made them so they are all StoryTime
(if that is what you want) and not Storytime or anything similar
(which is what you said you had in environment.rb). I am surprised it
ever worked with that. Another critical one will be the module
definition in config/application.rb.
Colin
I mean the only place i know that has storytime is the config.ru Ive
never manually changed the name to all case insensitive either.
changing it to Storytime instead of StoryTime wouldn’t let me run rails
s. I looked through all the changes I have made with git status and
looked through the files that I changed but there are not storytime that
i changed.