Ruby-on-Rails
  Home arrow Ruby-on-Rails arrow Page 3 - Ruby on Rails: Beginning Rails
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
RUBY-ON-RAILS

Ruby on Rails: Beginning Rails
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-04-28

    Table of Contents:
  • Ruby on Rails: Beginning Rails
  • Controlling the Situation
  • A View...To a Kill (Duhn Duhn Dun!!!)
  • What Everything is For

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th -1:00PM EST. Register Today!

    Ruby on Rails: Beginning Rails - A View...To a Kill (Duhn Duhn Dun!!!)


    (Page 3 of 4 )

    That's right folks, articles with sound effects. I'll be here all week.

    So far we have created a controller and an action, which handle requests from the user and respond to the requests, respectively. Now, with our view, we will display said results to the user.

    In order to do so, we create what is called a skeleton or a template web page whose ultimate purpose is to display something to the user. Actions use templates to store and display information, as you will soon see.

    Templates are named with the .rhtml extension. If you name them the same as the action, they are instantly connected. So, in our case, we will name our template file whatyoutalkingbout.rhtml.

    Creating our View

    Open up a text file and enter in this brilliant code:


    <html>

    <body>

    <h2>Welcome to the What You Talking About Website</h2>

    <br>

    <p>Here we will discuss what things Willis could have possibly been talking about, and furthermore, why Arnold was so damned anxious to find out...</p>

    </body>

    </html>

    Go ahead and save the file in the rubymyfirsttimeappviewswillis folder.

    Now start your WEBrick server again, as shown above. And finally, open up a browser and go to http://localhost:3000/willis/whatyoutalkingbout

    You should see the text:

      Welcome to the What You Talking About Website

      Here we will discuss what things Willis could have possibly been talking about, and furthermore, why Arnold was so damned anxious to find out...

    Congratulations on your first Rails web application.

    How it all Works

    When the user enters a URL, a request is sent to your web server, which is then decoded and sent to your controller. The controller then calls upon the actions that you create and passes the request on to the appropriate action. The action is determined by the URL. In our example, the action displayed a template with some data. Whoopee!

    More Ruby-on-Rails Articles
    More By James Payne


       · Thanks for stopping by to read my article. In this issue we discuss the beginnings...
     

    RUBY-ON-RAILS ARTICLES

    - Ruby On Rails: Making Your First Dynamic Site
    - Ruby on Rails: Beginning Rails
    - Ruby: Modules, Mixins, Fixins, and Rails
    - Controlling Information Access with the Rail...
    - URLs, Filters and the Rails Action Controller
    - Flash and the Rails Action Controller
    - Rails Action Controller
    - Dropping and Sorting with AJAX and script.ac...
    - Drag and Drop with script.aculo.us and Rails
    - Introducing script.aculo.us
    - Ruby Classes and Objects
    - Ruby Loops
    - Ruby Conditionals
    - Ruby Operators and Arrays
    - Ruby for the Newbie







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway