Cloud-oriented Life

Cloud Native Technology Improves Lives

nil?, empty?, blank?, and present?

Ruby and Rails have several methods that can be used to check for the existence of a value or the state of an object. Ruby provides #nil? and #empty?, and Rails’ ActiveSupport adds #blank? and #present?. All these work in their own way and it’s important to know how each evaluates data as using the wrong method in your code might cause unexpected results.

In this article, we’ll refresh your knowledge on these methods. We’ll (re)learn what conditions pass or fail when each is used as well as the type of objects each method can be used on. We’ll even throw in a handy cheat sheet at the end!

Read more »

Joins vs Preload vs Includes vs Eager load

Rails ActiveRecord provide few ways to load associated data and before moving forward.

let’s consider one scenario as below, there is a User table that has a one-to-many association with the Post table.

Read more »

Rails Cache

Caching means to store content generated during the request-response cycle and to reuse it when responding to similar requests.

Caching is often the most effective way to boost an application’s performance. Through caching, web sites running on a single server with a single database can sustain a load of thousands of concurrent users.

Rails provides a set of caching features out of the box. This guide will teach you the scope and purpose of each one of them. Master these techniques and your Rails applications can serve millions of views without exorbitant response times or server bills.

Read more »

jbuilder

Jbuilder gives you a simple DSL for declaring JSON structures that beats manipulating giant hash structures. This is particularly helpful when the generation process is fraught with conditionals and loops. JSON objects can be use in RESTful API or composing objects.

Read more »

YAML

Welcome to the Yaml Cookbook for Ruby. This version of the Yaml Cookbook focuses on the Ruby implementation of Yaml by comparing Yaml documents with their Ruby counterparts.

YAML™ is a readable text format for data structures. As you’ll see below, YAML can handle many common data types and structures. And what YAML can’t handle natively can be supported through flexible type families. For example, YAML for Ruby uses type families to support storage of regular expressions, ranges and object instances.

Read more »

Future Value, Scarcity and Substitution Cost

There are three main points of salary increase, Future Value, Scarcity and Substitution Cost, and the effect of the three of them is in this order from high to low:

  1. Future Value

  2. Scarcity

  3. Substitution Cost

Read more »
0%