Buying for a Team? Gift This Course
Wishlisted Wishlist

Please confirm that you want to add Getting Started with Ruby on Rails to your Wishlist.

Add to Wishlist

Getting Started with Ruby on Rails

Foundations for Building Web Apps with Ruby on Rails
4.4 (104 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
9,431 students enrolled
Created by Paul Krause
Last updated 9/2013
$10 $20 50% off
2 days left at this price!
30-Day Money-Back Guarantee
  • 16 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Have a coupon?
What Will I Learn?
Basics of Ruby
The MVC architecture of Rails
How Rails supports the Development of Models
How Rails supports the Development of Views
Best Practice in the use of HTML5 and CSS3
Best Practice in Behavioural Driven Development
How to use an extensive range of Ruby Gems to maximise productivity
CSS3 Animations
Responsive Design
View Curriculum
  • Some experience in computer programming
  • Ideally some experience in Object Orientation

This course covers all you need to get started with building Web applications with Ruby on Rails. It takes you from basic material on the best practices that are embedded into the Rails framework, through to advanced material on developing real time applications with Rails.

The course contains screen casts and practical examples. We show you how to get coding right away using Nitrous - a cloud based development environment. So there is no need to spend time on the tedious business of installing tools on your own machine.

I am not a full-time teacher. My courses are informed by extensive real-world application development both in industry and academia. So I teach you what works in practice, and by following this course you will benefit from my 35 years' experience in a wide range of software engineering projects.

Who is the target audience?
  • Those with a wish to gain a broad foundation in the technology and processes needed for developing Web Applications with Ruby on Rails.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 47 Lectures Collapse All 47 Lectures 15:56:31
Basic Introduction to Ruby for Rails Developers
7 Lectures 01:57:00

This lecture introduces the goals of the course, and then moves on to some Ruby basics, followed by a picture of the Rails framework. It's a fairly light-weight lecture so let it all wash over you and get ready for a bit more work next time.

Preview 27:57

Installing Ruby on Rails on your own machine can be a real pain point. I strongly recommend using the development environment "in the cloud". It all works smoothly and enables you to get straight into learning Ruby and Rails. This lecture shows you how to get started with Nitrous.

Preview 17:08

The Nitrous Desktop is now available for both Windows and Mac. It enables you to synchronise files between Nitrous and your local machine. This means you can (a) keep a local copy of your Nitrous project, and (b) edit the project with an editor on your own machine and have it synchronise with the project in Nitrous. At the end of the lecture I introduce the Interactive Ruby Console (IRb) that will be used in the next few lectures on Ruby.

The Nitrous Desktop

This lecture covers some basics of Ruby, focussing on some of the features that are particularly exploited in Rails. It also introduces Classes in Ruby.
A Little Deeper into Ruby

This lecture looks at how to read and access class instances in Ruby, how to control access to Ruby's methods and how to declare subclasses of a given class. It also contains a short but important homily on the difference between a variable and the internal representation of an object that is referenced by a variable.
Classes in Ruby

Now you have some familiarity with Ruby, it is worth getting to know the IRb (Interactive Ruby) tool a little better to enable you to explore the language. This lecture contains some worked examples of using the IRb to introduce the basic commands and some of the cool things you can do if you want to experiment with Ruby.

Interactive Ruby: the IRb

This handout contains an extended coding example in Ruby in order to provide a little more detail about some aspects of the language. It also contains a few simple exercises to test your understanding. Answers to these will be available in the supplementary material section.

A Little Practice with Ruby
8 pages
Handling Static Pages in Rails
3 Lectures 01:02:53

Now we can start to take a look at Rails. In this lecture, I will provide a quick reminder of the details of the MVC architecture, show some basics of using embedded Ruby to generate content for View files and finally use Rails' generated links to navigate between pages.

An archive of the complete project that was created for this lecture can be found in the supplementary material. I do strongly recommend taking the trouble to type up the code for the project by hand first, but you may find the archive useful to refer to if you have any problems.

Introducing Rails

This lecture introduces the larger sample application that we will use for the remainder of the course. We will explore rails routes a little more, and then introduce the layout file that fleshes view files out into complete html documents. Finally, we will introduce helpers, that can be used to customise view files.

Static Pages in Rails

In this lecture, we will introduce the use of Rails' "partials" to capture small reusable chunks of html content. Specifically, we will use partials to capture the header, footer and nav bar for our website.

We will also take another look at our routes, and introduce the Rails "link_to" method.

Fleshing Out the Content
Getting Your Processes Sorted
5 Lectures 01:38:30

Process is important. It is particularly important when you are working with a team. But even if you are working on your own, using the techniques and tools that I will introduce you to in this chapter will protect you from a number of potential disaster scenarios, and help to ensure that you deliver a quality product to your customer.

This opening lecture provides a short overview of the material that will be covered in the rest of this chapter.

Preview 13:26

There are two broad choices for a Rails development environment. Many prefer the lightweight command line plus programmer's editor route. The alternative is to use a full fledged IDE. I will talk about both in this lecture.

I will also briefly cover the options for backend database.

Setting up your Development Environment

Another best practice that is supported by Ruby and Rails is Behaviour Driven Development. This lecture introduces two BDD tools, Cucumber and RSpec. Cucumber supports the creation of feature level scenarios. RSpec is more usually used for specifying behaviours of smaller chunks of code. Both levels of specification can be executed against the code base and so are essential tools for supporting iterative specification/development/test cycles.
Behaviour Driven Development

Having developed well specified and tested code, you will now want to maintain it in a carefully managed repository,won't you! In this lecture we will review the fundamentals behind the distributed version control system Git, and show you how to set up a remote repository in GitHub.

Version Control with Git and GitHub

The final part of this chapter covers the use of Heroku to deploy stable increments of your project "into the Cloud". This enables you to close the feedback loop with your customer and is a key part of the process. We will also take a quick review of what we have learnt in this chapter.
Early Deployment and Reprise
Now Add Some Database Magic
5 Lectures 01:45:31

We will replace the static Events page with a dynamically generated index of Events in this lecture. This will introduce you to Rails' Active Record. This manages the Object-Relational mapping that takes care of the relationship between a Rails model at its persistent representation in the database. We will use a scaffold generator to produce the: events controller; all the views that correspond to actions in the controller; an update to the routes.rb file; the database migration; and, of course, the Event.rb class for the model itself.

Using Active Record

We have generated a model with a CRUD interface so that users may add and update events. But we also need to ensure that all the data that must be provided before an event is saved, is indeed provided - and in the correct format. For that we use Rails Validations. Even more importantly, we need to ensure that only authorised users change data. We introduce Ruby's Action Callbacks and then use these to place an authentication layer on those actions whose access needs to be controlled. Rather than code up authentication from scratch, we will use the Devise gem. This will also introduce you to the use of Ruby Gems.

Validations, Action Callbacks and Authorisation

Building Associations between classes is so easy in Rails. This lecture demonstrates how we can use Active Record to build a one-to-many association between two classes in a model. We also show how to ensure that dependent objects are destroyed automatically when a parent object is destroyed.

Capturing Associations between Classes

Rails has some impressive support for Model Building in Active Record. The key thing about this is that (a) Rails uses conventions to free you from the routine configuration of your model implementation, and (b) you are now free to think deeply about your domain model. In this lecture we will say a little more about the association types that are supported by Active Record, but more importantly, start to show you how to think deeply about your models. Be very clear about this. No matter how good you are at developing Rails apps, there will always be someone who is better. But your Model is going to remain your unique selling point - you have to get it right!

Thinking About Your Models

We left the sample application with a couple of issues. Firstly, the foreign key for the event that is associated with a comment needed to be added manually. In this lecture we will see how to automatically pass the foreign key to the comments controller. Secondly, the comments are on a different page to the associated event. We will move the comments for a specific event to that event's Show page. Finally, we will use some jQuery magic to hide and reveal the comments list without page refresh. This will provide an introduction to the use of jQuery and unobtrusive JavaScript.

You will find a zip file containing the complete code for the project so far under the Resources section. This should have all the links correctly setup as per the discussions around this lecture, but do send me a message if I have missed anything.

A Little Bit of Tidy Up with jQuery
A Touch of Style
3 Lectures 01:31:42

As we build up content in this Chapter, we will also start to style our sample web application. Before we commit to styling we need to pull together a Boilerplate of best practice to handle cross-browser compatibilities and other known issues to ensure our application has a consistent look and feel.

Laying the Foundations for a Makeover

We will gain more experience of using the new HTML5 elements in this lecture. They will help us provide meaningful structure to the pages in our application. In addition, we will start to bring in some basic styling with CSS.

Semantic Markup with HTML5

CSS can do magic, but it also does a lot of things badly.

Sassy CSS sorts out the issues properly and makes CSS truly DRY. We will first introduce Sprockets - a general purpose tool for managing asset pipelines. Then we will show how SCSS enables you to define and structure your styling assets much more effectively than was possible with vanilla CSS.

Sassy CSS
Take a REST
2 Lectures 01:02:28

In keeping with its maxim of "Convention over configuration", Rails includes support for designing/generating "RESTful" APIs. In this chapter, we will review the basics of routing in Rails, and then discuss how the concepts of REST (Representational State Transfer) are used in Rails.

RESTful Rails

This lecture looks in detail at the mappings from Routes to Controller Actions that are automatically generated for you when you declare a Resource in Rails. As well as simplifying the navigation through your application, it also automatically generates a public facing RESTful API for you. We will show how to make this API respond to requests for different representations of a resource.

RESTful CRUD in Detail
And a Sprinkling of Gems
3 Lectures 51:06

Ruby Gems enable you to extend Rails Core with best practice solutions for many of the common programming problems that are found when building Rails Apps. These are easy to plug into your project and offer mature and stable enhancements. We will explore some of the best in more detail in the remainder of the lectures in this chapter.

A Sprinkling of Gems

Active Admin is a rich and powerful Gem for generating the back end Administration functionality for a Rails Web Application. It includes Devise for authentication, and use Formtastic to generate the forms it uses. It is highly recommended, and extensively used by the Rails community to provide the Administration components of web applications.

N.B. Some of you have seen a clash between the earlier installation of Devise and Active Admin. As a result, you may find it easier/safer to start this lecture with a clean build of the sample application that has not got Devise installed. The archive file that is available here as a download should provide a good starting point. Once you have unzipped the file, you will need to cd into its root directory, bundle install and migrate the database to the current version. Then check it runs okay. Once that is done, you can install Active Admin as per this lecture. Note that once you have installed Active Admin, you will need to add the authentication filters in as per Lecture 14 - this includes adding in the sidebar that is described in Slide 17 of that lecture. (Note also that the before_filter you need to use is: authenticate_user!.

Active Admin

These two gems offer complementary functionality. CarrierWave supports upload of media files into a Web Application. RMagick provides some extremely useful image processing capability. We will see how these two gems can work together to enable us to add the capability to upload image files, and have them automatically resized into versions that are suitable for different uses in our Sample Application.

CarrierWave and RMagick
Now What Have We Got
1 Lecture 08:24

I give a quick summary of where we are, and then provide some pointers to sources of material for continuing the adventure.

If you are ready to take a more intensive web development course, Bloc offers a Developer Apprenticeship. You can save $100 on enrollment with the coupon code "learnrails".

How Bloc Works:

  • Continuous coaching: Meet 3 times per week, one-on-one, with a Bloc mentor vested in your success.
  • Intensive: Bloc is a results-focused program with a 25 hour/week commitment.
  • Real-World projects: You'll build clones of Reddit, Wikipedia, Kissmetrics, and Google Reader and learn industry standard tools.
  • Jump-start your passion project: As your final capstone project, you'll build your own Ruby on Rails website from scratch with your mentor's help.
Where to now?
Starting the Move to the Next Level
2 Lectures 01:18:36

This lecture covers more detail about Git. While much of the focus is on the use of Git's capability for using branches, a number of other important features are introduced. Once you have gone through this lecture you should have enough information to both work on your own projects and contribute to a shared project.

More on Working with Git

We show off ActiveRecord::Live with a simple application for streaming data from the server into a client view. We start off with the simplest of examples but gradually refine this into a comprehensive end-to-end example that captures all the key technology you need to stream data into a Rails View. There is a lot of new stuff in this lecture: JavaScript; jQuery; Server-Sent Events. I will introduce these, but we will go into them all in more depth as we progress through the advanced material.

My First Real Time Rails App
Appendix: HTML5 Basics
14 Lectures 03:53:34
As a bonus for all those taking this course, I have included all the material in my "HTML: Ready, Set, Go" course as an appendix.
In this first lecture, we answer the question of what is HTML. This naturally leads into a short discussion on why it is important to take a standards-based approach to using HTML. Finally, the lecture provides a short overview of the content of the remainder of this Appendix.
What is HTML?

In a sense, HTML as we know it today was not "built by design". Instead, it has evolved over the last twenty years through a collective learning experience from standards bodies, browser developers and users. The very high level history of HTML in this lecture focuses on some key milestones that helped to define HTML as it is today.
A Short history of HTML

This short lecture introduces the key elements that are needed in a valid HTML document.
The structure of an HTML document

The HTML Document Object Model (DOM) support an alternative representation in which HTML elements in a document are represented as objects. The DOM API then enables properties of the elements to be changed, and even for elements to be added to, or removed from, the tree of objects. Consequently the DOM plays important roles in the styling of HTML (using CSS) and the dynamic update of content (using JavaScript). 
The Document Object Model

Given that the textual content is barely visible in a browser, it is important to understand that the <head> element is a critically important part of your HTML document. Apart from the Docytpe declaration, it is the first part of your document that a user agent sees, and so sets expectations for the remainder of your document. It is also where references to the stylesheets and script files that are used in your HTML document belong.
The "head" element

The latest HTML5 specification identifies a number of categories of elements. However, the basic distinction between block type and inline elements is still very useful for understanding the overriding purpose of the different elements. They work at very different levels of granularity: block type elements provide structure to an html document; inline elements mark up small sections of content in a block that need to be distinguished in some way.
Block type and inline elements

The two key lessons of this lecture are:

  1. Follow the HTML5 recommendation of declaring your document as using the UTF-8 Unicode encoding scheme;
  2. Once you have done that, eliminate (as far as is possible) character references.
You will also find the Unicode Character Code Charts to be a useful reference:

Character encoding

We are now in a position to start marking up the text in a document. HTML5's new semantic elements provide us with more flexibility and more precision in structuring our documents. We first show how restrictive life was with HTML4, and then use a simple example to demonstrate the effectiveness of the new semantic elements.
Marking up text

Tables got a bit of a bad name as they were often misused for laying out web pages. Don't ever do that!!! However, tables are a valuable tool for presenting large amounts of data. This lecture will introduce you to how to use HTML to provide a clean semantics to the elements in a table.

The use of forms is pervasive on the interactive Web. I will introduce HTML forms and demonstrate best practice in marking up a form to fully describe its structure. This is especially important in order to support accessibility. 

Links are the stuff of the Web. Given their importance, the syntax for a link is mercifully simple (and rightly so). Nevertheless, there are some good practices to take note of, and some bad practices to steer clear of.

All the work in the last three chapters has been helping you to produce valid HTML5 documents. But there is still the chance of errors arising. These will not necessarily be picked up by browsers, as they are designed to be error tolerant. This is a key difference between parsing HTML and parsing XML. In the case of the former, a browser will try to second guess what you intended if it finds an error. In the latter case, the browser will simply stop the parsing and return a failure condition if it finds an error. But you should still try to flush out any errors as they will manifest themselves sooner or later in a hard to diagnose failure. This lecture shows you how to use the W3C validator - do it, it does not take long!

The Web is all about access to all, and HTML5 provides strong support in this direction. Nevertheless there are still a number of additional techniques that can be used to enhance the accessibility of your site. We will discuss some of them in this lecture, but be aware that this is the start of a journey that will continue through the exploration of CSS and Dynamic HTML.

Now we are at the end of the course, let's just sit back with a reflection on the overall messages of the course. You can also see some pointers as to what to work on next.
Review and next steps
1 More Section
About the Instructor
4.4 Average rating
115 Reviews
10,432 Students
2 Courses
Professor of Software Engineering, University of Surrey

Paul Krause is Professor of Software Engineering at the University of Surrey. Prior to moving to his full-time Professorship in 2003, he was a Senior Principle Scientist at Philips Electronics. During his time at Philips he consulted widely with their global software development teams in Bruges, Eindhoven, Vienna, Bangalore and Singapore. He also wrote and delivered training courses on a wide range of advanced software development techniques both to individual teams and at the Global Philips Software Conference.

Since moving to the University of Surrey, his teaching has focused on Web Technologies. He teaches at both Undergraduate and Postgraduate level, with his courses always receiving very strong scores in the student feedback. He uses many of the technologies he teaches in his research work, ensuring that his taught material is both up to date and full of practical insights. During the last 13 years he has delivered introductory, intermediate and advanced level courses on: Java, Ruby on Rails, JavaScript (including Node.js, jQuery and Angular.js) and Behaviour Driven Development.

Prof. Krause was one of the authors of the first versions of the British Computer Society’s Information System Examination Board’s Foundation and Practioner’s Software Testing syllabuses. He is Editor (Computing and Software) of the Institute of Engineering and Technology’s Journal of Engineering, and a Guest Mentor at Coding House, CA.

He has travelled widely in Europe, Africa and Asia both for pleasure and for work. This has given him a broader perspective than just the technical aspects of his work, and this is also reflected in some of his Udemy courses.

Report Abuse