# Beginner: First 'app' not displaying in browser

**URL:** <https://www.ruby-forum.com/t/beginner-first-app-not-displaying-in-browser/92908>\
**Category:** Rails\
**Created:** [April 25, 2007, 4:35pm UTC](https://www.ruby-forum.com/t/beginner-first-app-not-displaying-in-browser/92908 "2007-04-25T16:35:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe3000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9a28c/32.png) [@joe3000](https://www.ruby-forum.com/u/joe3000)\
**Post date:** [April 25, 2007, 4:35pm UTC](https://www.ruby-forum.com/t/beginner-first-app-not-displaying-in-browser/92908/1 "2007-04-25T16:35:27Z")

</div>

I have just started looking at Ruby on Rails and am following a book  
‘Beginning Ruby on Rails’.

The first exercise is to display a webpage but when entering the url in  
Firefox it doesnt display.

I get this error message:

Page title:

Action Controller: Exception caught

Page body:

Routing Error

no route found to match “/app/greeting” with {:method=\>:get}

- 

All I did was add these lines:  
def greeting  
end

to application.rb so it now looks like:

# Filters added to this controller apply to all controllers in the

application.

# Likewise, all the methods added will be available for all controllers.

class ApplicationController \< ActionController::Base

# Pick a unique cookie name to distinguish our session data from

others’  
session :session\_key =\> ‘\_hello\_session\_id’  
def greeting  
end  
end

Any ideas?

Thanks.

---

<div class="post-metadata">

**Author:** ![joe3000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9a28c/32.png) [@joe3000](https://www.ruby-forum.com/u/joe3000)\
**Post date:** [April 25, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/beginner-first-app-not-displaying-in-browser/92908/2 "2007-04-25T16:53:11Z")

</div>

Joe 3000 wrote:

> I have just started looking at Ruby on Rails and am following a book  
> ‘Beginning Ruby on Rails’.
> 
> The first exercise is to display a webpage but when entering the url in  
> Firefox it doesnt display.
> 
> I get this error message:
> 
> Page title:
> 
> Action Controller: Exception caught
> 
> Page body:
> 
> Routing Error
> 
> no route found to match “/app/greeting” with {:method=\>:get}
> 
> - 
> 
> All I did was add these lines:  
> def greeting  
> end
> 
> to application.rb so it now looks like:
> 
> # Filters added to this controller apply to all controllers in the
> 
> application.
> 
> # Likewise, all the methods added will be available for all controllers.
> 
> class ApplicationController \< ActionController::Base
> 
> # Pick a unique cookie name to distinguish our session data from
> 
> others’  
> session :session\_key =\> ‘\_hello\_session\_id’  
> def greeting  
> end  
> end
> 
> Any ideas?
> 
> Thanks.

I’ve never seen that book, but as far as I know the “application.rb”  
file is not meant to be used that way. What you need to do is generate a  
new controller and put “def greeting” in there. For example in the  
console/command line type:

/script/generate controller test

That should create a file called “test\_controller.rb”. Open that file  
and put “def greeting” in there. The URL will then be “/test/greeting”.  
Of course, you also need to create a view for greeting called  
“greeting.rhtml” that conatins some HTML, or you need to render text  
directly in the controller.

Anyway, I don’t want to get into a major rails tutorial. I mainly wanted  
to point out the usual way to start up a rails application. Sounds like  
that book may be a bit too complicated for the basics or you’re not  
following it correctly. I recommend you look at the following very, very  
simple and well written A-Z tutorial:

> **[Radar - O’Reilly](https://www.oreilly.com/radar/)**
>
> Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology

---

<div class="post-metadata">

**Author:** ![joe3000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9a28c/32.png) [@joe3000](https://www.ruby-forum.com/u/joe3000)\
**Post date:** [April 25, 2007, 5:28pm UTC](https://www.ruby-forum.com/t/beginner-first-app-not-displaying-in-browser/92908/3 "2007-04-25T17:28:38Z")

</div>

Joe 3000 wrote:

> Routing Error
> 
> no route found to match “/app/greeting” with {:method=\>:get}

By default, the URL for /app/greeting will look for an app controller  
with method greeting. Since you do not have an app\_controller, it  
failed.

Btw, ApplicationController should be used as a base class, not as a  
concrete class.
