Image for post
Image for post

Last time I briefly introduced the CMS engine for Ruby on Rails. I hope you have started building your site or planning your new project around this. It’s a powerful and fully customizable CMS. In my last article, I have talked about the features and how it could integrate with your existing application. Now I want to show you some more advanced customization that you may find it useful should you want more control.

If you have not read my last article, you should read it first.

There are several things that you can modify the CMS Admin and I…


Image for post
Image for post

I have done numerous web-based projects. Whenever it is customer facing, most of them requires some kind of customized content that needs to be changed from time to time. For simple pages, you may just be tempted to create a few using pages_controller to handle the static pages. For more complicated and required more frequently changed contents, a proper CMS is always a necessity.

I have been in love with LocomotiveCMS for sometime, but recently I have been using ComfortableMexicanSofa for several projects. …


With the COVID-19, we are forced to stay home. In my part of the world, we are no different. I have been working from home for almost 3 months. Working from home was never a stranger to me with my line of work. And over the years, I have been doing several upgrades to my office at home to make me working more efficiently and productively. Very recently I have been implementing 4 new upgrades.

Image for post
Image for post
My Home Office

Something I have upgraded awhile back…

Chair

Before I purchased my chair that I am sitting on, I was having a Renberget chair from Ikea. It has been serving me really well…


Image for post
Image for post

When developing your apps, a lot of times you have to create different types of forms for your users to fill in. There could be a simple form where it only involves one model, or there could be many more that involves a chain of models. In this article, I am going to show you how to deal with different types of situations.

  • Set up a form — has_many or has_one relationship
  • Delete an associated object

All my UI components are based on Fomantic-UI. You can refer to my previous article for reference if you are interested.

Set up a form — has_many or has_one relationship

Starting from Rails…


Image for post
Image for post
  • Install text editor
  • Add new text content to ActiveRecord
  • How it looks like in the form
  • Save the content

In Part 1 of the series, we talked about the RESTful API and token authentication. We will continue to extend our Travel Planning application.

Install text editor

Before Rails 6 if we are to use WYSIWYG editor, there are a number of options like CKEditor or TinyMCE. Now in Rails 6, it comes with Trix Editor that is developed by the people creating Ruby on Rails and Basecamp.

To install it is very simple, you run rails action_text:install. Once it’s done, you will see


Image for post
Image for post

When I am building my app, I need to add a calendar to show a list of events to remind me of the appointments and schedules. Recently I have been exploring with a JQuery plugin called CLNDR. Unlike many other calendar libraries, this library provides the data and you are responsible for the HTML template with an optional template engine of your choice. I chose the Mustache.js for my project. Here is what I do:

  • Installation of the JS libraries
  • Integrate with your Rails front end
  • An example

Installation of the JS libraries

CLNDR is a jQuery plugin. It requires only 2 dependencies:


Image for post
Image for post
Connecting our applications with APIs
  • Create a Rails 6 application
  • What is API?
  • Your first API
  • Secure your API with token authentication

In this many parts of this series, we will be creating a Rails 6 application using many of its newly introduced features to show you how it works in a real life example.

Create a Rails 6 application

For how to setup your environment on a Ubuntu, you can refer to my article “How to install Ruby On Rails and MySQL on Ubuntu 18.04”.

To install Rails 6.0, do gem install rails -v 6.0.0 after you do the gem install bundler.

Now it’s time to create a new…


Image for post
Image for post

You may have heard of VPN or have used it before. If you do not know what it is, here is a quote from Wikipedia,

A virtual private network (VPN) extends a private network across a public network, and enables users to send and receive data across shared or public network as if their computing devices were directly connected to the private network.

Why do I need VPN? One reason is your company want you to continue your work while you are at home or anywhere in the world. Once you establish a VPN connection and your computer would be…


Image for post
Image for post

For web development projects, you must have experienced using different open sourced plugins and frontend frameworks. While Ruby on Rails is always my primary choice of web framework, you also need a frontend framework to cater your responsive HTML layout and standard components.

Frontend Framework

Bootstrap 4

It is a popular choice and I love this framework a lot. It has evolved a lot of since the date after Twitter released it in Github for public use. The grid system, the standard components and the javascript integrations are typical for all web applications. It saves you a lot of time when bootstrapping your new…


Image for post
Image for post

Every project you created, whether it’s a side project or your project at work, would eventually deploy to a server. I wrote this guide to show you how this process is done.

  • Create a Rails 5.2 application
  • Push to Git repository (GitHub or Bitbucket)
  • Set up Capistrano and deployment script
  • Prep work on production environment
  • Run the deployment script

Create a Rails 5.2 application

Your first step is to have your rails application set up. I do all my development on Mac OS. You will need to install Homebrew first. Open your Terminal

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Then install Rails 5.2.3 and create a…

Billy Cheng

Share my tips and codes on my work with Ruby on Rails — Hong Kong

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store