Table of Contents

View Screencast (Quicktime)
Right-click and choose Save As to save file to your computer


Sign Up Now!

If you aren’t already receiving our course lessons via email, sign up now to be sure you don’t miss anything.

Every few days, we’ll send you an email with a link to the next episode, plus a list of additional resources for advancing your knowledge.

There’s no cost and no obligation. And we’ll never share your email address with any third party.


We’ll send you the first lesson right away.


Want to help spread the word? We’d be grateful if you would include a link to the course in your blog, web site, or emails.

The Simplest Possible Rails Application

30 comments

Welcome to the first screencast in the Learning Rails free online course in Ruby on Rails.

If you want to follow along on your own system, you’ll need to have a basic Ruby on Rails development environment set up. Check Lesson 8 for details on how to do that.

We’d love to hear any feedback you may have on this screencast. Please add your comment at the bottom of the page.

In this lesson, we build a very simple Ruby on Rails application, with just a few static pages, so we can walk through the files that make up a Rails application and show how the view system works.

The simple approach we’ve taken here isn’t something we would recommend for a production Rails application; it’s designed to cut away as much complexity as possible so we can focus on the essentials. In the next lesson, we’ll start building a more dynamic site.

There’s not a lot of code in this first lesson, and we’ll be replacing it in the next lesson, but you can download the full application if you’d like.

P.S. We’re still refining our production workflow, and the video in lesson is not quite up to our production quality goal. You’ll see improvements in future lessons.


Add a Comment

Have a comment or question about this lesson? Add it here.






Comments on This Lesson

From: Jose Ignacio       Date: 07/02/08 03:03 AM

Subject: Problems starting server

I Have already installed Rails 2.1 (following instructions in the last podcast). If I try to start the server (ruby script/server), I get the following error: Please `gem install -v=2.0.2 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed. Only when I do not create the folder LearningRails_9 by typing: “rails LearningRails_9”. When I create the folder running rails namefile -> script/server launches Mongrel and everything works wonderfully.

Is there something wrong with my installation?

thank you for your help!

From: John       Date: 07/02/08 01:01 AM

Subject: Feedback and a question

Execellent job, great site and Ror rocks….it’s amazing to see how fast the site develops out of nothing…anyway, i have a question…how does Ruby know that it has to generate home.rhtml.erb when the <=yield> command has been given. Is it hardcoded somewhere ? —From the code

<%= yield %>

How does it understand that yield takes home.rhtml and why not other files in the directory ?

From: Henry Happ       Date: 06/30/08 03:15 PM

Subject: FIXED: routes.rb changes don't work

Nevermind. I forgot to remove the default index.html file from the public folders. Shame on me.

Again, great tutorials!

From: Henry Happ       Date: 06/30/08 03:15 PM

Subject: routes.rb changes don't work

I love the way that you are doing this and I am following along in a VM’d environment. The only issue that I had with the tutorial was that the change to the routes file didn’t work. I still get the default ruby page. Furthermore, when I click on the “Home” link from any of the pages, I get taken back to the default Ruby page again. Any ideas? Thanks.

From: Henry Happ       Date: 06/30/08 03:15 PM

Subject: routes.rb changes don't work

I love the way that you are doing this and I am following along in a VM’d environment. The only issue that I had with the tutorial was that the change to the routes file didn’t work. I still get the default ruby page. Furthermore, when I click on the “Home” link from any of the pages, I get taken back to the default Ruby page again. Any ideas? Thanks.

From: Jose Ignacio       Date: 06/29/08 06:18 PM

Subject: script/server does not work for downloaded file

Everything worked well after creating the file by executing command rails filename, but if I download the source file or even if I move the folder created by rails command, $script/server does not work anymore (even though I am in the correct/new folder). What is going on?? Does rails creates some kind path for mongrell – how to recreate?—thx anyone

From: Bryan       Date: 06/23/08 07:07 AM

Subject: Thank you both!

Michael & Christopher,

Thanks for the wonderful screencast! This is really made learning rails fun and worthwhile.

From: Bryan       Date: 06/23/08 07:07 AM

Subject: Thank you both!

Michael & Christopher,

Thanks for the wonderful screencast! This is really made learning rails fun and worthwhile.

From: Darius del Rosario       Date: 06/09/08 07:07 AM

Subject: Thank you so much!

Hi Michael and Christopher,

Thank you so much for this wonderful screencast! You were very organized in how you presented the things you wanted to teach, and though I initially had difficulties because I was following your tutorial on Windows XP, once I had the initial settings configured correctly, creating the site was such a joy!

Thank you, thank you, thank you… You saved me a lot of time, since most of the tutorials I’ve encountered are based on the “Agile Web Development..” book (which is rather outdated at this point in time, I must say.. yes, even the 2nd edition) which starts with a complex e-commerce site that I really don’t want right now. Your simple static web site is right on target!

Again, thanks. Hoping for more tutorials from you both.

Darius

From: David Frink       Date: 06/01/08 02:14 PM

Subject: sqlite3 error

Tim,

I had the same problem. Rails 2.0 defaults to use sqlite3 as the database (which is not installed by default for Windows, AFIK). These tutorials are using MySQL so you need to tell Rails to use that instead.

To fix this, I edited my database.yml file as suggested here: http://wiki.rubyonrails.org/rails/pages/TutorialStepOne

If you’ve got a password on your database, be sure to included it in the file.

Then I ran “rake db:create” from the command line.

After that I didn’t have any problems.

From: Marcos Ricardo       Date: 05/25/08 07:19 PM

Subject: feed back and request

Hi Michael and Christopher,

Well, I have just carefully watched the lesson 9 screen cast. And I will try to do it over NetBeans later.

First, a feed back: GREAT JOB on the screencast, really cool.

Second, a request: I’m not a web developer, so, animations like those (“Anim1.swf” and “Rails Routing.swf”) presented on the screen cast, helped me a lot.

Could you please include those “.swf” files on the lesson companion material? Or split the animations explanation on separate “.mov” files ? And If possible, would be nice an even more detailed animation in the future ? Showing how a RoR application works (at files level, on the server side, I mean).

The reason ? I think these animations are a fundamental learning tool for non web developers like me. And in that case, we will need to watch them more then once, during the course, to fix the ideas and behavior, behind a web application.

Thanks in advance, and thanks for the course so far.

From: Michael Slater       Date: 05/14/08 10:10 AM

Subject: Editors vs. IDEs

Jason, this is a big subject on which there’s a wide variety of opinions. Using a text editor and a terminal window, you have a relatively thin layer between you and the Rails framework. You need to remember some commands, instead of being able to do everything by choosing a menu item, but rarely do you encounter any delays from your tools, and rarely do they actively get in your way.

With an IDE, such as Aptana, everything is brought together for you in a single interface, and most everything can be done via a menu choice. But there’s more work in learning the tool, it tends to be slower, and sometimes it just doesn’t seem to do what you want.

IDEs also can provide features that you don’t get in a text editor—like the ability to click on a method invocation and be brought (relatively) instantly to the file that defines that method.

I’ve used NetBeans fairly extensively, and when it is good, it’s great. It had some growing pains during that Rails 1.2 to Rails 2.0 and NetBeans 6.0 to 6.1 transition, during which it cause me serious grief. I ended up switching to TextMate, and while there are a few things I miss from NetBeans, I like the speed and reliability of working in TextMate.

From: Jason Willis       Date: 05/14/08 08:08 AM

Subject: Text Editors vs IDEs

Could you explain the pro/con of using ‘E’ vs something like aptana? (either free or pro version) Thank you!

Jason

From: Christopher Haupt       Date: 05/09/08 08:20 PM

Subject: E TextEditor for Windows

I’ve been very impressed with the E-TextEditor for Windows (http://www.e-texteditor.com/) which is a near port of TextMate, but for Windows. It even shares support for almost all of the same plugins (called bundles). It is commercial, but pretty inexpensive.

From: Michael Slater       Date: 05/09/08 07:19 PM

Subject: NetBeans

To be honest, we gave up on NetBeans. It’s in better shape now, but there were some rough patches when 6.0 was missing some critical features for Rails 2 and the early 6.1 versions were unstable. We also found that, as a teaching tool for wide audiences, there was too much that was peculiar to NetBeans that took time to explain and wasn’t helpful for the vast majority of developers who are using other solutions. With TextMate and the console, we’re using nothing that isn’t available in virtually any text editor and console. It shouldn’t be hard to translate to NetBeans, but we’re not going to cover NetBeans specifics. (We’ve also moved all our own development work to TextMate. NetBeans just didn’t give us enough back for the grief it gave us.)

From: Marcos Ricardo       Date: 05/09/08 06:18 PM

Subject: Where is the annouced Netbeans ?

Hi,

Just one little complain.

At the beginning, you stated the course will use Netbeans on the lessons.

Watching the first three Screen casts, I just see the regular Mac / Text Mate version…

Any chance I could see a Netbeans version ?

Regards.

From: Tim       Date: 05/06/08 02:14 PM

Subject: Could'not manage to complete the lesson on Vista

It looks like something is not configured. I could’not see the versions of my gems on the index page. I follow the Steps in the tutor of how to run Rails on Vista and even reinstall to make sure i do everything right. Also no content in pages/home, it says MissingSourceFile in PagesController#home This error occurred while loading the following files: sqlite3

I really need you help guys…

From: Erwin Odendaal       Date: 05/06/08 11:11 AM

Subject: html working

I already discovered that you need Rails 2.0 for the code to work. On my system (xcode 3.0!) it was still Rails 1.x…

From: Erwin Odendaal       Date: 05/06/08 11:11 AM

Subject: html not working

I’ve followed your instructions carefully and everything went as you showed in the screencast. What didn’t work was the file “application.html.erb” The sourcecode of “http://localhost:3000/pages/home/” (or any of the other pages) didn’t contain the html-code added. What can there have been gone wrong?

From: Zeck       Date: 05/02/08 12:00 AM

Subject: screencast#9

Thanks a lot for your great work !

From: reinhard staudinger       Date: 04/19/08 07:07 AM

Subject: screencast #9

thanks a lot for your great work! it makes it easy to dive into ror. greetings from austria!

From: reinhard staudinger       Date: 04/19/08 07:07 AM

Subject: screencast #9

thanks a lot for your great work! it makes it easy to dive into ror. greetings from austria!

From: Robert L. Crocker       Date: 04/15/08 05:17 PM

Subject: Screencast #9

Good introductory tutorial on controllers, routing, layouts, and CSS. I’ve been through quite a few different tutorials so some of this stuff was already kind of making sense to me but this screencast really put it all together. Keep up the good work guys.

From: Al       Date: 04/13/08 06:18 PM

Subject: Screencast #9

I have listened to all 9 episodes. Suggest providing a list of clickable list of links for the “dropped in” code (you had 3 of them i think in #9) in the screencast, so I can “drop it in” as I follow along. Thanks for a great serie.

From: Shannon       Date: 04/10/08 03:15 PM

Subject: Thank You!

Your explanations, particularly of routing, are excellent. Very clear and well supported with your graphics. Looking forward to the next one.

From: Dave       Date: 04/10/08 11:11 AM

Subject: Thank you!

Gentlemen, This is what i’ve been looking for! I picked up Ruby as my first programming language ever in 1/08. I built along with you and this is my first ever web app (or web page period!) Thank you Looking forward to forthcoming lessons…

From: Ryan Dougher       Date: 04/09/08 04:16 PM

Subject: Awesome!

Your audio podcasts have already been a huge help to me, and now the video podcast is just fantastic. I can’t wait to see more of them. Your lessons have been the best I’ve found on the internet, especially for people like me who have zero experience in web programming. Keep up the great work guys!

From: Robert L. Crocker       Date: 04/09/08 03:03 AM

Subject: Screencast

Thanks for the effort guys. I’ve listened to the podcasts a couple of times. Looking forward to the screencast and hope to make it to one of your seminars this year.

From: Ljuba       Date: 04/09/08 01:01 AM

Subject: A Wonderful Beginning

Great job on your first screencast. I’m a huge fan and loving the lessons. Thank you for providing a bridge for people familiar with HTML and CSS and not diving in right away with building database tables and raking and so on.

When I saw the title “The Simplest Possible Rails App” I thought, “Oh no, a blog application,” but I was delighted to find something new compared to other tutorials I’ve seen. The parts about having multiple views to a single controller and changing the routes.rb file were really useful for beginners like me.

The “slow motion” effect in the screencast is a bit distracting. It’d prefer to see the real-time video if possible.

Again, great job!

From: Thomas Schmidt       Date: 04/09/08 12:00 AM

Subject: Screencast

Loved your first screencast. I am just getting started with Ruby on Rails and I am very excited to move forward. I have listened to all your podcasts. You have a beautyful way of making things easy to understand. I hope to be able to sign up with one of your seminars soon. One question though: if you are up and running Ruby on Rails with your provider, why not start every project even static ones in Ruby, eventually they will become dynamic. Just a thought. Kind regards, Thomas Schmidt, Denmark