Ruby on Rails

Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.

ruby-on-rails rubyonrails ruby rails

Algorithms: Calculating Combination with Ruby

I studied philosophy and taught courses on Symbolic Logic. I can talk about deductive proofs for days, but when people pull out a f of n’s… x²… [insert Greek letter].

Active Record Validations

When I was first learning Ruby, I used a variety of if/else statements to “validate” user input and prevent breakage in my CLI applications. I’m sure you can understand this was not the most efficient way to go about safeguarding your code — though it was prior to learning the ultra-powerful, time and energy-saving, omniscient Active Record. In this post, I’m going to outline the importance of using validations and some of my most used Active Record Validations helpers.

Sideroo: Declarative & auditable key management Ruby gem for Redis

Declarative, intuitive, auditable, and object-oriented. Redis is one of the most popular in-memory data structure servers, often used as a database, a cache, and a message broker. The popularity is thanks to its enormous versatility and the wide variety of use cases it enables. Working with Redis in Ruby is amazingly simple to start. After setting up a Redis instance, you add redis gem, write a short piece of code, then here we go.

How to Install RSpec in Your Ruby on Rails Backend

Installing RSpec made simple. When you’re a junior developer and you’re starting to test for the first time, the most difficult part is deciding on a testing library and getting it up and running. Once you pick a library and get it installed, it really isn’t difficult to start testing your entire application — most testing libraries are fairly easy to get the hang of.

Why Your Web Server Should Log to Stdout (Especially with Docker)

In this video, we'll go over both the why and how to set up a number of web app servers to log to stdout. Since changes in a running container will get wiped out after a container stops, it’s typically a good idea to configure any Dockerized service to log to stdout and then configure the Docker daemon however you see fit to store your logs.

Seeding Your Rails Database With A Spreadsheet

Did you find a great spreadsheet you would like to use to seed your database? Or maybe your client has given you an excel sheet of information that you need to seed the database with for their webpage? I’m sure you don’t really want to, nor have the time to copy and paste all of the information into your seed file. This would take precious time away from building out a beautiful application with a bunch of great functionality!

What are Environment Variables in Rails?

What exactly are “Environment” Variables in our Rails applications and why do we use them to store sensitive Rails application data? When I was learning about developing Rails applications, I learned that we should keep our application’s secret keys in the application’s ‘environment variables’. Environment variables are not tracked by Git, therefore they won’t be committed to public repositories. As a result, our keys are kept safe and our applications are secure.

Ten Virtual Conferences to attend in 2020

A look at 10 virtual conferences you can attend online this year, to beat the coronavirus blues. While there were a lot of conferences scheduled for the year, the coronavirus episode means that most of them have been canceled. Thanks to the advancement in technology and better internet penetration, we have a lot of these conferences moving online.

Doubles, Instance Doubles, and Spies in RSpec

Recently, I was creating a small project to play around with new concepts I had learned for RSpec testing in Ruby and realized something. How exactly do I test an instance(or class!) method in one model that relies on the result of a method from a different model entirely. I’ll give you my basic example. I had a User model and a Pet model, whereby the Pet belonged to the User.

A First Look at Crystal Programming Language and it’s Ecosystem

Crystal is a general purpose, statically-typed, object-oriented, and compiled programming language coming from Manas Tech. The language has been in development since 2014 (for about 6 years now) and the most recent language version is 0.35.1. While everyone eagerly waits the official release of version 1.0 of Crystal, I came across this language and wanted to take a first look.

How to speed up assets precompile for Ruby on Rails apps

If you spend too much time to deploy your rails project especially on the assets:precompile step, and maybe sometimes you see the following error during the assets precompilation: So for sure, this short article will help you to have 50% improvement only with some minor changes.

Automate Tasks in Rails Using the Whenever Gem

A walkthrough of cron job implementation using the whenever gem. Before we can jump in to using the whenever gem, we need to learn about Cron. Cron is a utility that is used to schedule commands at specified intervals, and is most likely already on your machine. It’s ideal for automating recurring tasks, called cron jobs. Cron jobs can be written directly in a config file called a crontab

How To Upload and Display Images Trough IBM Cloud with Rails 6

This is a tutorial about how we can implement IBM Cloud Storage in our Ruby on Rails 6 projects. We can upload images and manage these assets with Rails. In this tutorial we are going to build a simple app. We can upload a kitty photo and vote for that photo (this tutorial only includes the part of creating a new Rails app, configuring it to save our photo on the cloud, and showing it on an image tag; the design and the part for the photo will be included in the app but is not shown in this tutorial).

Why use Nginx for Flask/Django/RoR?

Why do we use Nginx (webserver) in front of an application (Flask, Django, Ruby on Rails, NodeJS, etc)? I will be talking about Flask over here, but this applies to all Frameworks such as Django, Ruby on Rails, NodeJS, etc. If you are interested to know, how to deploy Flask Applications with uWSGI and Nginx, please check this out.

Test-Driven Development With Stripe and Ruby on Rails

A practical guide to testing your payment integration. For my projects, I usually end up creating at least three separate Stripe sub-accounts: one for development (for testing by hand), one for testing (automated tests), and one for production.

Centralized Logging: Parse Key-Value Logs With FluentD

Extract key-value pairs from log lines using the FluentD parser. In my previous blog posts, I explained how to use FluentD to parse and ship logs to a centralized logging server (EFK stack), Parse multi-line logs for Rails applications, and provided an overview of some of the most used plugins for parsing logs with FluentD.

Backend Developer Roadmap for 2020

Backend Developer Roadmap for 2020. Roadmap for backend developers in 2020. The 2020 backend developers roadmap.

Ruby on Rails Digest: 26 most Popular Repositories in June 2020

Welcome 26 most popular, most interesting, and useful Ruby on Rails repositories on GitHub in June 2020.I’ve stopped making Rails digests since last year. But today, I’m officially coming back to my favorite monitoring. Please, welcome the most popular, most interesting, and useful Ruby on Rails repositories on GitHub.

9 tips to improve RSpec maintainability

Writing good test cases is as important as writing good code. Well written specs would help identify bugs as well as act as good documentation. Here are 9 tips to UP your RSpec game. There are 2 principles that will lead us through these tips DRY — Don’t Repeat Yourself principle Use the right tool at the right place for the right purpose

Add Authentication to Your App With BCrypt and JWT

A good app is a secure app.In a recent software engineering interview, questions about authentication came up. It was a harsh wake-up call to realize that I am incredibly rusty in this area. I have recently had a habit of skipping authentication entirely in my projects, as they are relatively small in scale and contain dummy seed data with no sensitive information.