Course

Build a Simple Ruby on Rails Application

This project will walk us through creating a social networking web application with features similar to Facebook. Ruby on Rails is a web application framework which makes it easy and quick to build dynamic web sites.

9 Achievements

There are many things involved in creating a complicated web application. There are clients, servers, and all of the things in between. This stage walks us through what web applications are and the process of installing Ruby on Rails.

A large part of creating web applications is designing what the user sees when they view a page. This includes the HTML markup and CSS that styles the pages. This stage introduces views in Ruby on Rails, and how they let us shape the content.

A common feature of web applications is to allow people to sign up and create an account, and then be able to log in with an email address and password. There are many security concerns that need to be taken into account when implementing such a feature. Fortunately, Ruby on Rails has several pre-built tools to make implementing a login system easy.

Forms are an important part of any web application because they are how the user interacts with the app. Creating forms that are easy to use is simple to do with Ruby on Rails when you use the built-in tools and some other popular tools built for Rails.

Make yourself the default

Automated testing is a powerful tool that every developer should master. By writing tests that verify your code works as expected, you can reduce the number of unexpected bugs that make your app fail. Writing these tests also helps ensure you don’t break some other part of your app while building a new feature.

Take a look at the resources documentation. Try updating the routes file so the statuses resources is served from /updates not /statuses . Configure it so the new action is available under /updates/create

In addition to testing small, specific functions of the web application, we also need to test that larger use cases are working properly, by writing higher level tests. We use these tests, called integration tests, to make sure common features like logging in and creating an account work for the user.

Integration Tests

The profile page is the foundation of our social network application. Each user will have their own profile page with their own custom URL based on their username. This profile page will initially just show the status updates that the user has posted.

Favorites

Now that uses have a profile page, why not try adding some of their favorites to it? This could be favorite movies, TV shows, hobbies, and more. Try adding a migration to the user model and then displaying the information on a user's profile page.

The most important step of creating our application is deploying it to the internet. While developing, we run the app locally to test it, but its final home is on the internet. There are many different ways of deploying a web application, but one of the easiest ways is Heroku, which lets you deploy your app for free.

Instructors

When not fighting web crime, Jason Seifer is a teacher at Treehouse. He's passionate about the web and programming. You can find Jason on Twitter at @jseifer and on his personal blog at jasonseifer.com.