Course info
Apr 21, 2015
2h 12m

Using an example web application, this course demonstrates how to use Rails' latest features. The application is a simplified Q&A site for the history of the universe. Users can post questions about the universe and other users will be able to reply. We will talk about controllers, views, models, migrations, emails, background jobs, the asset pipeline, and a few other things. We will also learn how to deploy a Rails application to the cloud.

About the author
About the author

Samer Buna is a polyglot coder with years of practical experience in designing, implementing, and testing software, including web and mobile applications development, API design, functional programming, optimization, system administration, databases, and scalability. Samer worked in several industries including real estate, government, education, and publications

More from the author
React: Getting Started
4h 1m
Feb 25, 2019
Node.js: Getting Started
3h 29m
Sep 11, 2018
Advanced React.js
3h 54m
Jul 21, 2017
More courses by Samer Buna
Section Introduction Transcripts
Section Introduction Transcripts

Models and Migrations
In this module we're going to be working with data and explore how to work with Rails models and migrations among a few other things. We'll create our resources and models and we'll use a migration to create tables in the database. We're going to explore the Rails console, a very powerful tool that will allow us to work with models directly. We'll see what we can do with ActiveRecord and the methods we need to read and update the data. We'll then change our mockups view and bring them to life with real data. We'll see how to use instance variables in the controller to allow us to read data in the views. We'll also work a little bit with gravatars, which is a very popular service that turns emails into avatars. While working on the views we're going to use built in view helpers and also create our own view helpers. We'll also see how to submit data from HTML forms and we're going to explore Rails logs and how to monitor them for useful information. When we save new questions and answers to our database we need to use Rails strong parameters in the controller. I'll show you how to do that. And we'll also get a chance to explore URL helpers and reference URLs by name rather than by endpoint. We're going to be defining relationships between our question and answer models. A question will have many answers and an answer is going to belong to a question. We'll also see how to sort the data that we're displaying in the view. DRY in Rails is a big concept. It's about not repeating any code you use. We'll see what that means when it comes to methods common between multiple classes.

Action Mailer and Active Job
In this module we're going to improve the user interface of our questions and answers app a little bit, but we're going to sending emails. It's all about giving the user more information and making the interactions we require from them easier if we can. We're going to use the session concept in Rails to remember the user's email when they first use it. Then we'll prepare, test, and send emails to the author of a question when they receive a new answer. We will be doing this task with TDD. Testing is really important and Rails and encourages testing. We'll also explore how we can preview our HTML emails right in our browsers before sending them. We'll see how to simulate a slow process with the sleep method, then how to send emails with a background job using the sucker punch adapter.

Basics of the Asset Pipeline
We're going to be exploring the features of the asset pipeline in this module. But in order to do that we're going to need some assets first. The assets are everything static in the app including JavaScript files, CSS files, and images. We'll start by exploring the super powers of Sass and enhance the UI a little bit while doing that. Then we'll touch on CoffeeScript and also enhance our UI a bit using the power of jQuery, which is included by default in Rails. Once we have some assets to work with, we'll explore what we can do using the asset pipeline. We'll run our server in production mode and see how we can use the asset pipeline to compile, combine, and minify all of our assets. Also in this module we'll see how the app looks on small screen and if we need to do anything there.

In this module we will deploy our app to the cloud and make it accessible to everyone on the web. We will be using Heroku for that. We'll start by installing and configuring their toolbelt, which is a group of command line tools that we can use with Heroku. We'll see how to switch our production configuration to use PostgreSQL instead of SQLite. And we'll explore how to do this in the gemfile and how to use the bundle command also how to update our gems using the bundle command. I'll also show you how you can push the button to deploy to Heroku. And I'll show you a few handy things you can do on Heroku so that you can manage your app.