Unable to connect

$ rails generate controller home index

This created app/views/home/index.html.erb.

I deleted the index.html with: $ rm public/index.html

I edited my routes.rb file as follows:

Blog::Application.routes.draw do
root :to => “home#index”

But when I go to http://localhost:3000 I get the following message:

Unable to connect.

On 5 April 2011 06:12, wordmystic [email protected] wrote:

But when I go to http://localhost:3000 I get the following message:

Unable to connect.

Is that a browser message saying that it cannot connect to that URL or
a rails message? If a rails message please give the full error
message.
Have you started the rails server? If so what do you see in the
terminal window when you start the server and try to open the page?

Colin

The “Unable to Connect” message is a Firefox browser message.

When I open the server in the command prompt window I get a long list
of options and a description and example of the “rails new” command.
Then the cursor positioned after, "C:\Sites>.

Bruce

On Apr 5, 8:46am, Colin L. [email protected] wrote:

It sounds like the server is not starting, you should get a message
saying that it is started. What command are you running to start it?
Copy the command you enter and the first lines of the output and paste
them here.

C:\Sites> rails server
Usage:
rails new APP_PATH [options]

Options:
[–skip-gemfile] # Don’t create a Gemfile

…and so on.

Bruce

On 5 April 2011 17:02, Bruce [email protected] wrote:

Then the cursor positioned after, "C:\Sites>.

It sounds like the server is not starting, you should get a message
saying that it is started. What command are you running to start it?
Copy the command you enter and the first lines of the output and paste
them here.

C:\Sites> rails server

You should be in the root folder of your application, the same folder
where you typed
rails generate controller …

Usage:
rails new APP_PATH [options]

It is telling you that the only valid command in this directory is
rails new as you are not at the root of an existing app.

Colin

I’ve made that mistake myself a time or two (still new to Rails).

The idea, Bruce, is that you want to run your specific web
application.

If you think of it that way, that may help.

And not that I have a ton of experience, but I’ve found that when I
need to start the server then I’m usually inside that application’s
directory somewhere anyway.

On 5 April 2011 16:37, Bruce [email protected] wrote:

Please don’t top post, it makes it difficult to follow the thread,
insert your reply at appropriate points in previous message. Thanks.

The “Unable to Connect” message is a Firefox browser message.

When I open the server in the command prompt window I get a long list
of options and a description and example of the “rails new” command.
Then the cursor positioned after, "C:\Sites>.

It sounds like the server is not starting, you should get a message
saying that it is started. What command are you running to start it?
Copy the command you enter and the first lines of the output and paste
them here.

Colin

On 5 April 2011 20:44, Bruce [email protected] wrote:

directory somewhere anyway.

Thanks. Here is what I tried.

The new rails application I created is in the folder c:\Sites\blog\app

I think it is probably the blog folder that you should be in, the root
folder of the app, not the ‘app’ folder of the root folder of the app
:slight_smile: In fact it probably doesn’t matter, it seems to have worked out
what to do.

c:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1l8/gems/activessupport
-3.0.4/lib/active_
support/dependencies.rb:235:in '‘load’: C:/Sites/blog/config/routes.rb:
62: syntax error, unexpected $end, expecting KEND

That is saying it has found a syntax error at line 62 of routes.rb,
which is likely the end. You probably have an ‘end’ missing or
something similar. If you cannot see it paste the complete file here.
You can check whether you have got it right without starting the
server by running
rake routes
which should show the valid routes you have specified.

Colin

On Apr 5, 9:34am, dana tassler [email protected] wrote:

I’ve made that mistake myself a time or two (still new to Rails).

The idea, Bruce, is that you want to run your specific web
application.

If you think of it that way, that may help.

And not that I have a ton of experience, but I’ve found that when I
need to start the server then I’m usually inside that application’s
directory somewhere anyway.

Thanks. Here is what I tried.

The new rails application I created is in the folder c:\Sites\blog\app
I start the shell command on that folder and get this:

=> Bootiing WEBrick
=> Rails 3.0.4 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

Then a few seconds goes by and it continues with:

exiting
c:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1l8/gems/activessupport
-3.0.4/lib/active_
support/dependencies.rb:235:in '‘load’: C:/Sites/blog/config/routes.rb:
62: syntax error, unexpected $end, expecting KEND
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/
activesupport-3.0.4/lib/active_support/dependencies.rb:235:in ‘load’
from lists more ‘load_…s’ and more. It’s a long list
It ends with:
from C:/Sites/blog/config.ru:1:in ‘new’
from C:/Sites/blog/config.ru:1

C:\Sites|blog\app>

On Apr 5, 1:02pm, Colin L. [email protected] wrote:

And not that I have a ton of experience, but I’ve found that when I
what to do.
exiting
rake routes
which should show the valid routes you have specified.

Colin

Thank you Dana and Thank you, Thank you, Thank you, Colin!

I don’t know how my routes.rb file got so messed up, but it was a bit
of a jumble. Got it right and now am able to generate the index page
with http://localhost:3000.

The help was much appreciated.

Bruce