Expert Ruby on Rails 5 | Packt Publishing | Skillshare
Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
28 Lessons (3h 54m)
    • 1. The Course Overview

      2:37
    • 2. Setting Up Ruby on Rails

      13:32
    • 3. Cloud Deployment

      5:19
    • 4. Rails 5 and Ruby 2.3.1

      5:44
    • 5. Creating a New Rails 5 Project and Configuring an Alternative Database

      6:49
    • 6. Application Structure

      5:37
    • 7. Database

      5:48
    • 8. Testing

      7:21
    • 9. Authentication with Rails

      5:35
    • 10. Installing and Configuring Devise

      3:03
    • 11. Integrating Devise

      6:18
    • 12. Customizing Devise

      10:25
    • 13. Creating a Data Model

      5:17
    • 14. Building Relationships

      6:30
    • 15. Validations and Constraints

      7:03
    • 16. Fixtures and Tests

      6:06
    • 17. Routes and Resources

      7:20
    • 18. Layouts and Stylesheets

      14:09
    • 19. Controllers and Actions

      13:12
    • 20. Testing Controllers

      10:30
    • 21. RESTful APIs

      10:17
    • 22. Creating an API Project with Rails

      12:25
    • 23. Authenticating API Clients

      13:28
    • 24. Refining the API

      6:07
    • 25. Consuming the API

      27:16
    • 26. What Is ActionCable?

      3:25
    • 27. Setting Up for ActionCable

      5:33
    • 28. Creating Notifications

      7:29

Project Description

Section 1: Installation and Setup

In this section, we will see how to Install Ruby and Rails on your system and use RVM to easily manage different versions and dependencies.

1.1 The Course Overview

This video will give an overview of entire course

1.2 Setting Up Ruby on Rails

Before embarking on the course, attendees will need to have a correctly-setup development environment for Ruby on Rails 5

  • Install Ruby and Rails on our machine through Ruby Version Manager (RVM)
  • Manage our environment with RVM and gemsets
  • Installing PostgreSQL Database and other software

1.3 Cloud Deployment

Having setup the development environment for Ruby on Rails 5, we also need to know how to deploy our application.

  • Get to know various cloud platforms used for deployment.
  • Deploy our application to a cloud-hosted platform

Section 2: Getting Started with Rails 5

This section gives us an overview of the new features in Ruby and Rails and the creation and configuration of a new application.

2.1 Rails 5 and Ruby 2.3.1

In order to understand how this course utilizes the latest features of Ruby, you must know what new functionality is offered in Ruby 2.3.1 and Rails 5.

  • Outline the new features in Rails 5 and explain how they will be used in this course
  • Understand the new features in Ruby 2.3.1 and explain how they will be used in this course

 

2.2 Creating a New Rails 5 Project and Configuring an Alternative Database

The user needs to understand how to create a new Rails 5 app, what their options are when using the ‘rails new’ generator, and how to configure it to create a new app using their database of choice.

  • Review the options given by ‘rails new’ and their significance and run the ‘rails new’ command with the appropriate options
  • Edit the database.yml file to configure our database settings
  • Run ‘rails server’ and verify that our application is running

 

2.3 Application Structure

Before we start writing our Rails application, we need to understand what Rails 5 gives us out of the box and how we can configure our Rails 5 project with a suitable test environment.

  • Review the new files and folder Rails 5 created for us and understand their significance
  • Modify the Gemfile to use the Minitest framework

 

2.4 Database

Most web apps will need to create and store data and ensure that only appropriate data is stored in the app. Rails achieves this with data models, migrations, and validations.

  • Use a Rails generator to create infrastructure for our data
  • Run migrations to apply changes to the database
  • Create data validations and verify that they are working

 

2.5 Testing

Testing is an extremely important part of software development and is particularly emphasized and supported within the Rails community. This video will cover the basics of test writing using Minitest.s

  • Create test data using fixtures
  • Write some tests to cover the current validation rules
  • Learn how to use the Spec DSL within Minitest

Section 3: Authenticating Customers

Customer identification and access control is an important requirement of most web applications. Using an authentication gem is the best way to provide this functionality in Rails.

3.1 Authentication with Rails

You need to understand what type of built-in authentication Rails provides and why using the Devise gem is the best way to integrate authentication capability into our Rails app

  • Firstly, we’ll discuss the implications and the use cases of an authentication system
  • Then, we’ll explain what authentication mechanisms Rails provides out-of-the-box
  • Finally, we’ll review the Devise gem and explain how it addresses all the concerns that we raised previously

3.2 Installing and Configuring Devise

This video aims to teach how to install and configure Devise in your Rails 5 application

  • Install the Devise gem
  • Run the Devise generator
  • Change our code-base to enable Devise integration

3.3 Integrating Devise

Need to authenticate our application’s users (customers)

  • Use Devise’s generator to set-up authentication on our customer model
  • Learn about Devise’s helpers and use one to set customer authentication on specific controller actions
  • Run our rails server and see our authorization screens in action!

3.4 Customizing Devise

Devise’s default views and parameter methods don’t reflect our model’s specific fields

  • Override Devise’s default registration view
  • Overriding Devise's registrations controller
  • Tell Devise to use our own registrations controller

Section 4: Defining Relationships

Our customers buy our products and will want to give reviews or raise issues with them. Building the relations between customer, products, reviews, and issues will demonstrate the common ways of modeling our application data.

4.1 Creating a Data Model

An understanding of the data entities our application operates upon and the relationships between them is fundamental to creating and maintaining our app

  • Firstly, we’ll capture our data and its relationships in a conceptual data model
  • Then, we’ll generate Rails models for our data entities
  • Finally, we’ll run Rails data migrations to create database tables matching our data models

4.2 Building Relationships

This video aims to teach how to define and implement relationships for your data models

  • Learn how Rails 5 represents many-to-many relationships
  • Decide which kind of relationships are suitable for our data
  • Create our data model associations

4.3 Validations and Constraints

You need to know about the different kinds of model validations and database constraints, and how to apply both

  • Add some model validations
  • Add a database constraint
  • Use an example to discuss the different effect validations and constraints have

4.4 Fixtures and Tests

Having created models and associations, you need to know how to test them

  • Create fixtures for relational data
  • Create tests for model associations
  • Run tests

Section 5: Controllers, Views, and Resources

In this section, you will build a stylized dashboard with all the company’s products and their reviews and issues. The customers will be able to view, add, and edit reviews and issues but won’t be able to edit or delete products.

5.1 Routes and Resources

Setting up routing correctly and understanding its implications is the key to developing a web application

  • Firstly, we’ll discover how Rails does routing and the routes file
  • Then, we’ll explain the Rails route helper methods and their usage
  • Finally, we’ll set up some nested resource routing and examine its significance for our application

5.2 Layouts and Stylesheets

Most web applications require a usable and stylish frontend in order to be successful

  • Lay out the view using HTML tags and the embedded Ruby code
  • Create model methods and view helpers
  • Create CSS stylesheet and apply it to the view

5.3 Controllers and Actions

Users need functionality to view and manipulate reviews and issues for our products.

  • Use scaffolding to create controllers and views
  • Implement controller actions for nested resources (reviews and issues)
  • Implement independent views for nested resources (reviews and issues)

5.4 Testing Controllers

Having created controllers and actions, the attendee needs to know how to test them

  • Learn the changes Rails 5 brings to controller testing
  • Set up testing configuration
  • Write controller tests using Minitest-spec assertions

Section 6: Sharing the Message

In this section, we will learn about APIs and REST, and create a messaging API as a standalone app using Rails.

6.1 RESTful APIs

In order to be able to build a RESTful API, you must understand what REST is and what it takes to build a good API

  • Describe the REST philosophy and the REST constraints
  • Go through the six essential knowledge areas required for building APIs
  • Discuss the reasons for having separate APIs for some pieces of functionality

6.2 Creating an API Project with Rails

The know-how for the Rails API option and how to create an API project and expose a resource through it

  • Learn how to set up an API project with Rails
  • Create a message resource and configure its serialization and routes
  • Test our message resource’s API

6.3 Authenticating API Clients

APIs need to be able to authenticate their clients in order to be secure

  • Learn about the JWT standard
  • Install necessary gems and create infrastructure code, including the client model
  • Implement JWT logic in our Rails stack

6.4 Refining the API

You need to be able to test the authentication-led (JWT) APIs and implement query-based routes

  • Install the necessary gems for JWT API testing
  • Write tests that work with the authentication-led APIs
  • Modify #index to accept query parameters and test it

6.5 Consuming the API

We created an API app, but we don’t know how to use it from our Rails client

  • Set up the infrastructure (gems, controller, UI elements) to consume APIs
  • Create an adapter for the API
  • Define a send (outgoing) and a receive (incoming) workflow, and implement it with appropriate actions and view

Section 7: User Presence

In this section, we will add a status icon to indicate whether other users are online or not.

7.1 What Is ActionCable?

Attendees must understand what ActionCable is in order to build the User Presence feature

  • Describe the WebSockets protocol
  • Explore more about ActionCable
  • Understand how ActionCable works within Rails

7.2 Setting Up for ActionCable

Attendees don’t know how to begin and what steps to take in order to set up ActionCable functionality in a Rails project.

  • Track user state by creating cookies via Devise
  • Create an ActionCable connection and channel
  • Configure consumer connections

7.3 Creating Notifications

The aim of this video is to create notifications whenever the customer writes a review.

  • Broadcast new review results
  • Create notification UI area

Dynamically update the UI

Student Projects