Category Archives: Rails

Connecting MSSQL Database Using Ruby On Rails

This is a documentation on how to connect to a MSSQL database in a Rails application. We will use FreeTDS as the main toolkit to establish the connection. Motivation I came across a gig that requires me to connect to a MSSQL database to extract the data via the application that I was building in… Read More »

How To Add Datatables To Webpacker In Rails

This is a documentation of using datatables with the latest version of Rails (6.0 at the time of writing) that uses webpacker as the default Javascript compiler. I found some difficulty in looking for documentation of integrating this in the new Rails away from the lands of Sprocket. Hopefully this can help you and my future… Read More »

Why Is Render JSON And Return Not Working In My Controllers

Recently, I stumbled upon on an unexpected error when i was refactoring my code to follow the style guide of rubocop, Ruby On Rails’ very own linter. The and/or style guide recommends that the logical operator && be used in place of and. When I did that, my controllers started to break my tests. Return… Read More »

Reopen And Add Methods To Models In Ruby Gems

This is a documentation on how to add class and instance methods to models that exist in ruby gems. Often, there is a need to add methods to models that are created in ruby gems. In a recent project that I am working on, I found a particular need for adding images to a tagging… Read More »

Automate mysql_secure_installation Using Bash

This is a documentation on running a script to install mysql on a Ubuntu 18.04 server, specifically using the AWS EC2 image. Project Requirements I am playing around with Terraform at the moment and would like to automate setting up a staging server that will run a mysql instance inside it along with a Rails… Read More »