James Huynh My little tech blog

Using cron job and whenever gem to run scheduled task in Rails

Scheduled task is quite a common task in Rails. It can be scheduling to send a reminder email, or scheduling to crawl something from another website on daily basic. Rails does not have support for this type of feature out of the box, but we can use the combination between cron job and whenever gem to achieve the purpose. In this article, let’s quickly go through how to use this combination.

SSH Remote Access a server through another server

Recently, one of the app that I develop for our client would need to be hosted on a server that can only be accessed through another server. That has acaused me quite a few problems with ssh remote access and even deployment. In this article, I would like to share how I overcome the problem to easily remote access to the targeted server and deploy the app smoothly just like I have direct access to the targeted server.

Rails 5 - Real time Web app with action cable

Rails 5 is about to be really soon and one of the very exciting features that I really would like to make use of is Action Cable. This feature will enable our Rails app to be able to perform push request the first time instead of relying on a 3rd party gem / plugin like Faye.

In this article, let’s try to apply Action Cable feature into a traditional Todo list app and see how it will works and how it can make the normal todo list app more lively.

Save IRB and Rails Console history

This trick is super useful when you want to save the history of the commands that you have typed earlier in IRB or Rails console so that it can re-used back when you need. In order to enable this feature, follow the following steps:

Ajax Pagination on Rails and Kaminari

One of the most common tasks that our team always need to do is to perform pagination on a list of products or items. Usual pagination with Kaminari gem and page reload is good but with a bit addition on Ajax would make the application snappier and more user friendly.

In this post, I would like to introduce the way that I usually perform to convert a normal pagination to Ajax Pagination.