Latest Posts
Personal blog by Karina Baha.
-
Difference between URI and URL
In this post, we’ll discuss the difference between a URI and a URL. A Uniform Resource Identifier (URI) is a string that identifies an abstract or physical resource. A Uniform Resource Locator (URL) is a type of URI that, in addition to identifying a resource, provides a mechanism for accessing it.
-
Member and Collection Routes in Ruby on Rails
The routes of a Ruby on Rails application live in the config/routes.rb file. The Rails router matches a request in the browser to a controller action. The Rails default for routing is the resource routing. A resource route will map HTTP verbs like GET, POST, PATCH, PUT and DELETE to a controller action and also…
-
Using form_with With Nested Resources in Ruby on Rails
In this post, we will deal with using the form_with helper with nested resources in Ruby on Rails. We will build a blog application, and the blog posts will have comments. We will nest the two resources and will create a comment form partial that we will use to create a new comment and edit…
-
Difference Between Path and URL in Rails
In Rails, we often use the _path and _url helpers to link to various resources in our applications. But, what’s the difference between the two?
-
Replace Confirm Dialog Box with Sweet Alert in Ruby on Rails 6
In this post, we will discuss how we can integrate the Sweet Alert 2 library into a Rails 6 application. We will build a simple to-do app, and will replace the default confirm dialog box triggered by links such as delete links, with a sweet alert. We will use Rails 6.1.4.1 and Ruby 3.0.3.
-
Nested Resources in Ruby on Rails. Let’s Build a Dictionary!
In this tutorial, we will deal with nested resources in Ruby on Rails. This is useful when there is a has_many association corresponding to a belongs_to association between two models. We want to emphasize this logical relationship using nested routes. We will build a dictionary with letters, and each letter will be associated with words…
-
Play CSS Animation Only Once Per Website Visit
We have animated elements in the hero section of our website, but we do not want to play this animation all the time our users return to the home page where this hero section is. We want to play this CSS animation only once, when the user enters the site, and never again during the…
-
Uploading Images in Rails 6 Using Active Storage, Trix and Cloudinary
Active Storage is a Rails module used to upload files to a cloud service. Cloudinary is such a service and, in addition, a complex platform that enables developers to store, transform, optimize, and deliver images and videos. Cloudinary has a free plan available, and it’s quite easy to get started with them. Trix is the…