What is Authentication ? I guess you already know what authentication is. But if you have been living under a rock since the last decade: Authentication basically is a method to grant access to users who are using your app by verifying the identity of the user. This can be done by providing credentials like…
Continue ReadingMonth: July 2021
Displaying Public Activity with public_activity gem
Activity Logs An activity log is a record of logs that track user actions performed in an app. Activity logs are useful, because if something goes wrong, an user can check their activity log and see where they messed things up. Activity logs are common in social media sites like facebook, even github has one….
Continue ReadingAdding Upvotes & Downvotes in your rails app
The Acts As Votable Gem We can add likes/dislikes like youtube or upvotes/downvotes like reddit with a gem called ‘acts_as_votable’. This gem provides an easy process to add a voting functionality in your app. With this gem we can add upvote/downvote buttons and also count the number of upvotes/downvotes and display them easily. Github Link:…
Continue ReadingCreating A Photo Album App With Rails
Creating a bare bone photo album app Today, i’ll show you how to create a basic photo album app with rails6, i’ll be using active_storage to manage uploads/attachments of our photo album. This app will be a very basic photo gallery/ablum app with just the bare bones, so no special styles, no file validations, authentication,…
Continue ReadingAdding Pagination With Kaminari
Why Pagination ? As our list of record accumulates, we would not want to show the entire list of records in a single page, as this is impractical and will cause our rails app to get slower and slower and as well as degrade the performance of our database server. So, an easy way to…
Continue ReadingAdding Search functionality with ransack
Why a search functionality ? Why not? why not to make life easier by adding a simple search button ? its perfectly fine if i have ten or hundreds of records. But what if i have thousands or tens of thousands of records, i or any other user would not want to waste time by…
Continue ReadingActive storage deletes previously uploaded attachments ? how to fix
The Issue So here’s the problem that i faced whenever i uploaded mutliple attachments with active record. This only happens with mutliple uploads. So i have a model called ‘albums’, and albums have ‘has_many_attached’ photos’ attachment. So that i can upload multiple photos in a single album. When creating a new album record, i didn’t…
Continue ReadingDeploying fails on heroku? here’s what you can do to fix
Use heroku logs Heroku logs often provide in-depth useful information for debugging your rails apps, it shows us the exact block of code where the bug exists, sometimes it can be because of a typo or a problem with gem versions or something else. We can also use heroku logs with –tail to continuously get…
Continue ReadingAdding custom error pages to our rails app
Default Error Pages Rails already comes with its own error pages which is okay but too simple, but we can add our own custom error pages, just to make it look a lot nicer, here’s a quick and easy way on how you can do that. Popular Examples The default error pages that comes with…
Continue ReadingServing Static Assets from an external server or CDN
The Asset Pipeline The rails asset pipeline is the default way to serve assets to your rails apps, but it’s not the best and not the only way. By default rails will use the asset pipeline to serve static assets, its a quick and easy way to serve static assets, but it degrades the performance…
Continue Reading