UT on Rails

Last year I held a series of non credit Rails courses for University of Texas Students, i’m happy to announce that i’ve been granted an Adjunct Professor position at the UT and I’m teaching a for credit course in Databases and Rails. Lucky for you, i’m a sucker for online learning, so i’ll be putting all my course material online, right here.

The Course

This Ruby on Rails course is 10 weeks long and assumes you know very little about programming and have not used Ruby, Rails, or Databases previously. The videos are broken up by topic, so if you know one topic you can safely skip that video. Some weeks have exercises and quizes, this is the most important part of the course. Learning a new programming language or framework is like learning a new language, you have to practice to get good at it.

I’m taking a fairly non traditional approach to teaching Rails, so even if you’ve been coding for a year or so, you’ll still likely get something out of the course, especially the exercises. Please enjoy and share the material (all Creative Commons Attribution) and as always if you have any comments you can find me on Github and Twitter @schneems. If you’re new to programming don’t forget to check out command line basics.

This first week we focus on databases and won’t get into Rails until the second week. Skipping around is encouraged however if you don’t understand something please go back and check the previous material.

The first part of this lecture covers the format and content of the course, why we use databases, and how the web is structured around data and data storage. It’s fairly non technical, so feel free to skip if you already know how data on say Facebook gets saved when you submit a status update.

The first video in this series covers modeling a relationship between a car’s user and the car in databases. There are many different ways we could represent that relationship so this lecture covers quite a few of them, and talks about why or why not to represent your data using one of the methods.

1) Find 5 real world relationships and describe them using the database vocabulary we talked about in class. Has many, belongs to, has many and belongs to many, and one more we didn’t discuss has many through.

2) Build your first Ruby on Rails app. This exercise is about seeing the potential of Rails and getting you introduced to the technology. Don’t worry if you don’t understand all the directions, we will cover them ail in depth in later classes.

This week we will be focused on building cool things with Pure Ruby (no Rails). We’re going to cover some Ruby basics, and then dive into an exercise where we build an HTML generator using only Ruby. The students really enjoyed the exercise, and got quite a bit out of it, so you shouldn’t skip it. Even if you’ve been using rails for years, the exercise might give you new insight into how exactly some of that Rails magic works.

In this week’s videos we will be focused on URLs and HTTP wich are used in all of the web, not just for Rails. We’ll then take a look at how these two things can be brought together to form routes for our website, and how to map routes to views.

This week’s exercise use all of our view knowledge and all of our model knowledge together to build a website that allows us to view and add data to and from our database. We’ll also use the info we covered about HTTP and URLs in the videos. First go to the [Routes Model View Exercise](https://github.com/schneems/routes_controller_exercise]
Then fork and clone the project to your local machine. Continue by following directions in the readme.

Welcome back, so far we’ve taken a deep dive on models, views, and routes. While we’ve talked about controllers we haven’t talked about what they do, or what they’re good for. Guess what we’re talking about this week (hint, it’s controllers).

Now that we’ve got the basics of a Rails app down, lets spice things up by adding some javascript powered visualizations to our app. We’ll talk about javascript and the Rails Asset pipeline. In the exercise we’ll be adding a HighChart powered pie chart, and adding the ability to change the price of our products without reloading the page using AJAX!.

If you’re new to Rails and Active Record, or you’ve been using them for some time, there are likely methods you’ve been overlooking. This week I take a look at the most common SQL Query interfaces for Active Record.

This week we’re going to tackle some important concepts in Ruby like Dealing with Nil and using Modules in Ruby. We are also going to cover importing data from a spreadsheet, rake, rubygems, bundler, and talk a little about Rail’s testing ecosystem.

This week we’ll start a Hero’s journey to build a site similar to Reddit. You’ll need to use everything we’ve learned so far. This isn’t a follow along copy and paste tutorial, this is how I work when I’m making websites. Good luck, you’ll need it. Building Building Reddit in Rails

We are close to wrapping up our 10 week Rails Course. This week we will cover a handful of topics commonly encountered in Rails projects. We then wrap up with part 2 of our Reddit on Rails exercise!

By now you should be hard at work on your personal projects. The students in the course just presented in front of the class with some live demos and a brief intro to to the problems their app were solving. Maybe set aside some time this week to show someone your progress, block off 5 minutes and describe what goal you are working towards, the current state of the project (is it almost done, just getting started, needs UI, etc.), and then show them a quick demo of the app. Explain what type of feedback you are looking for (conceptual, design, usability, etc.) and see what they have to say.

Subscribe to my Newsletter 😻 🤠

Keep Reading 🚀

Today I have an unusual proposition for you. I’m spending a bunch of time to try to get Beto elected to Texas Senate, so I’ve not been able to write as much technical content. Rather than slow down on my door knocking, I’m looking to pick up the pace, and I want you to do it with me. Starting today, I’m offering anyone who phone banks or “block walks” (knocks on doors) the opportunity to win some of my technical time. Here’s how it’s going to work.

You might know rubocop as the linter that helps enforce your code styles, but did you know you can use it to make your code faster? In this post, we’ll look at static performance analysis and then at the end there’s a video of me live coding a PR that introduces a new performance cop to rubocop.

Rails 5.2 was just released last month with a major new feature: Active Storage. Active Storage provides file uploads and attachments for Active Record models with a variety of backing services (like AWS S3). While libraries like Paperclip exist to do similar work, this is the first time that such a feature has been shipped with Rails. At Heroku, we consider cloud storage a best practice, so we’ve ensured that it works on our platform. In this post, we’ll share how we prepared for the release of Rails 5.2, and how you can deploy an app today using the new Active Storage functionality.