Get an introduction to Ruby on Rails 5 by first learning the difference between Ruby and Ruby on Rails. Ruby is an object-oriented programming language. Ruby on Rails is a web application framework, which will provide project structure, libraries of code for common tasks, and sensible default behaviors. Ruby on Rails speeds up development, follows development best practices, and gives projects extra features for free.
- [Instructor] I want to start by introducing you to Ruby on Rails. Ruby on Rails is made up of two parts. Ruby and Rails. And it's going to be important to understand the difference and keep them straight in your head. Ruby is an object-oriented programming language created in 1995 by Yukihiro Matsumoto, who often goes by the nickname Matz. Ruby can be used for many purposes, not just for web applications, it's just a general programming language. In fact, on Lynda.com we offer Ruby Essential Training, which is a training course for the Ruby programming language.
Knowing Ruby is not a requirement before taking this course. We're gonna cover all the Ruby basics you need to get started. However it will be a great benefit if at some point you learn Ruby in depth. Everything in Ruby on Rails is built in the Ruby programming language. So it's common sense that you'll be a better Rails developer if you know Ruby well. Ruby's the foundation on which Ruby on Rails is built. In fact, personally Ruby is the thing that I like most about Ruby on Rails. I find the Ruby language to be a pleasure to work with.
It's object oriented, it's easily readable, and it has an unsurprising syntax and behavior. It's easy to write code and it avoids some of the headaches in other languages, such as ending every line with a semi-colon. Ruby on Rails is an open-source web application framework, which is written in the Ruby language. It was created in 2003 by David Heinemeier Hansson, who the community often refers to as simply DHH. Rails was created as the foundation for the Basecamp application, and then released as open source software for anyone to use in 2004.
Since then it's grown into a popular, active open source project with hundreds of contributors who submit new features, find bugs, and make speed improvements. Ruby on Rails Version 5 is what this course is gonna use. And it was released in July of 2016. Now the differences between version 4 and version 5 is that version 5 adds new features and improvements. There are very few breaking changes between version 4 and version 5. If you've been using version 4 before and you just want to know about the differences between version 4 and 5, we actually have a course on Lynda.com called Ruby on Rails 5 New Features, which just highlights the differences between version 4 and version 5.
This course is gonna focus on learning version 5 from the beginning. Now Ruby is a programming language. Rails is a web framework. Framework might be a new word to you. A framework is a set of code libraries and data-structures that provide generic functionality, which can be used, or it can overridden, or further specialized and change. Now you may wonder, how is a framework different from a simple code library? Libraries typically provide functionality that you can call upon, but they don't do anything until they're called.
The idea is that every piece of information should be expressed in just one place, and then you can refer to it from other places if you need to use it more than once. DRY code is easier to maintain because duplication can lead to inconsistency, make code unclear, and make it harder to maintain and update. Rails is built on this principle of don't repeat yourself, and it's going to encourage us to follow this principle in our code as well. It's considered a best practice. The Ruby on Rails framework also follows another principle, of convention over configuration.
The code is pre-configured to use default options which are gonna fit the most common usages. This is gonna speed up development and give us less code to maintain. Most of the time we can use the default settings, and we only needed to add code when we have use cases that are different. The defaults also follow best practices of web application development. So best practices will be built-in and improve our end product. Rails is very opinionated about what those best practices are. Most of the time, they're not controversial, but every now and then you may disagree with one of its default choices.
But, that's why you can override the defaults whenever you'd like. The Rails framework also has many default features built in, especially web security features. Many of them happen automatically and you may never even notice them. Other features are not automatic, but are available if you ever decide that you need them. Working with a framework can pay big dividends as your web application matures and grows. So who should use Ruby on Rails? Well the short answer is that anyone can use Ruby on Rails. However, the people that are going to get the most benefit are developers who have some previous web experience, who already understand how the web works.
Developers who want to built sites which interact with databases, or those who are tired of creating and recreating site functionality from scratch every time are gonna get a big benefit out of switching to a web framework. And Rails is great for developers who are concerned about following best practices, web standards, and web security. Rails is gonna help us with all of those things. There are no prerequisites to taking this course, but there are some recommended skills which will make it much easier for you. Understanding the basics of how to web works such as browsers servers, and pages.
- Creating and configuring a new Ruby on Rails project
- Generating controllers and views
- Handling server requests
- Using different types of routes
- Rendering and viewing templates
- Generating migrations and models
- Creating, updating, and deleting records
- Finding records with queries
- Understanding relationship types
- Writing controllers for CRUD
- Working with layouts and helpers
- Managing application assets
- Building forms
- Validating data
- Authenticating users