Author: Saim Khalid

  • File Uploading

    You may have a requirement in which you want your site visitors to upload a file on your server. Rails makes it very easy to handle this requirement. Now we will proceed with a simple and small Rails project. As usual, let’s start off with a new Rails application called FileUploadapp. Let’s create the basic structure…

  • Action Cable

    Rails follows the MVC architecture and by default uses the HTTP protocol to handle the request-response cycle in a web application. However, since Rails version 5, the Action Cable feature was included to lend support for the new WebSocket protocol. Unlike the HTTP protocol, WebSocket is an asynchronous protocol, thus enabling real-time communication between the…

  • WebSockets

    In this chapter, you will learn how to use the Action Cable feature in Rails to build a real-time chat application that employs the WebSocket protocol. What are WebSockets? The World Wide Web primarily works on the principle of REST, which encapsulates the HTTP protocol. However, one of its drawbacks is that it can be slower for…

  •  AJAX

    Ajax stands for Asynchronous JavaScript and XML. Ajax is not a single technology; it is a suite of several technologies. Ajax incorporates the following − Ajax enables you to retrieve data for a web page without having to refresh the contents of the entire page. In the basic web architecture, the user clicks a link or…

  • ImportMap

    In Rails, the Asset Pipeline library is designed for organizing, caching, and serving static assets, such as JavaScript, CSS, and image files. In this chapter, you will learn about ImportMap that streamlines and optimizes the delivery of JavaScript to enhance the performance and maintainability of the application. From Version 7, Rails uses ImportMaps as default, enabling building…

  •  Propshaft

    Asset Pipeline in Rails is a framework that helps you manage and deliver static assets â€” like JavaScript, CSS, and image files — in an organized, efficient, and performant way. Earlier versions of Rails used a gem called Sprockets for the asset pipeline. However, there has been a lot of evolution of Asset Management Techniques within the last few years, leading to…

  • JavaScript

    In this chapter, you will learn how to integrate JavaScript functionality into your Rails application, and how you can use external JavaScript packages. This chapter also introduces Turbo which is used for creating fast, modern web applications without having to reach for a client-side JavaScript framework. In modern web development, we often break our JavaScript into many…

  • Active Storage

    In this chapter, you will learn about the Active Storage framework in Ruby on Rails. Active Storage was introduced in the version 6.1 of Rails. Active Storage enables uploading and attaching files (e.g., images, videos, PDFs) to the Rails models. It supports storing files on local disk as well in the cloud like Amazon S3,…

  • Action Text

    In this chapter, you will learn how to handle rich text content in a Rails application with the help of Action Text component. We will cover the following topics in this chapter: What is Action Text? Installing Action Text enables you to display the rich text content – text that can including formatting features such…

  • Active Job

    The Active Job framework in Rails is extremely helpful for declaring background jobs and executing them asynchronously. Applications that involve background tasks such as sending emails, pushing notifications, background processing of CSV files and backing up the databases, integration with external apps through APIs, handling file uploads, etc., can be scheduled with Active Job framework.…