Lesson 2
Anatomy of a Web Application
To listen to the lesson, click the Play button on the left. You can also right-click on the download link to save the mp3 file, or you can subscribe in iTunes (just search for Learning Rails).
To read a transcript of the lesson, click the Transcript link on the left.
The heart of the lesson is the audio; these notes are supplementary. So please listen to the audio, or read the transcript, before making use of these notes.
Examples used in the audio program
Here’s some of the examples we use in the show, which may be easier to grasp in printed form:
- If the user types www.BuildingWebApps.com/podcast.html into their browser, they’re asking the server at BuildingWebApps.com to find a file called podcast.html and send the contents of that file to the browser.
- In a Rails application, the request would be written as www.BuildingWebApps.com/podcast, in which podcast is the name of the controller to be invoked
- A Rails URL such as www.BuildingWebApps.com/podcast/show/17 invokes the show action in the podcast controller and passes it the parameter of 17 (presumably the ID for a podcast episode).
- To request all the podcast objects, the controller would execute a statement such as
podcasts = Podcast.find(:all). (Don’t worry about the odd punctuation for now. - To find a particular podcast episode according to its episode number, the show action might execute a statement such as
podcast = Podcast.find_by_episode(2)
For More Information
See the notes for Lesson 1 for pointers to online resources and books about Ruby and Ruby on Rails.


Reader Comments
27 comments
lesson 2
From: Patrick Hop, 07/16/10 11:19 PM
thank you!
Querry
From: Sunny, 02/21/10 08:18 AM
In rails model deal with DB. all DB queries should have in model? is this right or we can write some DB query in controller itself?
Querry
From: Sunny, 02/21/10 08:18 AM
In rails model deal with DB. all DB queries should have in model? is this right or we can write some DB query in controller itself?
Querry
From: Sunny, 02/21/10 08:18 AM
In rails model deal with DB. all DB queries should have in model? is this right or we can write some DB query in controller itself?
Best way to start rails in mac
From: Runy, 01/25/10 10:20 PM
Hi what is the best way to develop rails applications on the mac? I'm using instantrails on windows which is great because it has mysql build in. I needed mysql on the mac but didn't get it working. Radrails on mac from aptana is horrible because nobody seems to be able to get it working with mysql.
Thanks!!!!
From: mr49online, 09/15/09 09:54 PM
Thanks a lot, for giving such a to the point lessons for learning newbie in rails, like me ... Keep it up....
learning rails-web anatomy
From: Jitesh Dedhiya, 07/17/09 07:07 AM
Hey! thanks for these series.Helping me a lot to know about ROR.The Simplicity of lessons is helping me to understand very fast.The way the lessons are introduced step by step are great.Great work guys!!!
learning rails-web anatomy
From: Jitesh Dedhiya, 07/17/09 07:07 AM
Hey! thanks for these series.Helping me a lot to know about ROR.The Simplicity of lessons is helping me to understand very fast.The way the lessons are introduced step by step are great.Great work guys!!!
learningrails podcasts
From: eric, 02/17/09 01:46 PM
Thanks very much for this series. I've tried to dive into rails twice before and become frustrated by a certain point. Conceptually, rails is a steep learning curve, there seem to be a lot of things to comprehend at first, it's fat at the bottom. Having listened to your first three podcasts several times over I'm beginning to see that, although there are many pieces each piece is small and managable. I'm ready to start try again.
Ruby Software
From: Michael Slater, 01/24/09 05:36 PM
See http://www.buildingwebapps.com/articles/6491-setting-up-rails-on-windows-vista
Ruby Software Download
From: Herb Walfoort, 01/24/09 04:55 PM
Hi What is the URL to Download the Ruby program for use on Windows Vista? Thanks in advance Herb Walfoort
Thank you for all lessons
From: Zeck, 10/02/08 08:16 PM
First of all thank you Mr Michael and Christopher. I think this is a best free online screencast. Looking forward to the your next one
Lesson#2
From: cherrian chin harada, 09/21/08 06:42 AM
Michael & Christopher, my sincere thanks to you both... Love your lessons. Looking forward to the your next one :-) lesson
Lesson 2
From: Charlz, 08/07/08 10:13 PM
Hope next time we can see some more examples from the audio.
Credit to...
From: Thura, 07/20/08 02:49 PM
Thanks…good concepts/points on ruby on rails.
NO much images
From: Julio, 07/04/08 12:17 PM
I haven’t a great Internet line, so don’t put much images, or maintain one page without them, please…
FROM URL TO SERVER RESPONSE
From: Aron Grinshtein, 06/23/08 12:55 AM
I didnt understand the difference between how regular HTML and PHP sites process going to a website and how RUBY processes visiting a website.
Please elaborate, a diagram may help.
Thanks!
Very interesting course!
From: Jesus Armando Garcia Quiñones, 06/18/08 09:36 AM
Hi to all! i’m from Mexico and want to be thankful to them for this opportunity to learn RoR. i was reading many text but, in this case i consider is very clear and easy to follow. Thank’s and good work!
PD. Excuse me if my English not is very good.
Nice course!
From: Murillo Parreira, 06/14/08 03:45 AM
Hi folks, i’m from Brazil and around here, RoR isn’t very popular… Despite this fact, i’ve been studying on my own and learning to really like Ruby and Rails by the simplicity and ‘beauty’ of the code…
Just want to say: ‘Keep up the good work!’ The iniciative is really inspiring!
=D
Great! Add images!
From: Rich Webster, 05/14/08 12:05 PM
This is the best free RoR thing I’ve found. By following the text while listening, it somewhat satisfies my learning style, but diagrams of the relationships, and ultimately (when you get down to code) having video of the code, as it is entered, would be great. I don’t think audio alone will cut it for me, in the long run. I would be OK with inline examples on the transcript page, but that would not be ideal.
I just finished an online class thru a community college, and this is at least as helpful, so far. The instructor in that class provided videos, but he was less organized at communicating the concepts. I also like the two-voice technique. Keep that up.
Learning Rails
From: Phil Leeson, 04/26/08 08:50 AM
Excellent – very clear and concise and also very practical. These tutorials are just what I need. Thanks!
Very Informative
From: Naushad Pasha, 04/21/08 07:10 PM
Its clear and understandable, Well only suggestion is we should have the video lessons also so that any person who is very new to rails will understand better.
Thanks Naushad Pasha
good~
From: iceskysl, 04/18/08 11:39 AM
very clearly and useful.
thanks!
From: zain alabdin tawfiq, 04/12/08 06:55 AM
I don’t know how to thank you, I’m searching for ROR tutorials and this seems like a good one!
Text is available
From: Michael Slater, 04/09/08 01:46 PM
If you’re looking for text versions of the audio lessons, just click on the Transcript link on the left side of the lesson page.
Screencasts start soon
From: Christopher Haupt, 04/07/08 12:40 PM
Stay tuned, as we’ll be posting screencasts starting with Episode 9.
Text lessons
From: Muhammad, 03/30/08 12:09 AM
Hi manager, can you send me an text lessons because I don’t understand it very really :-) thank you Muhammad