[Awesome Ruby Gem] Use kaminari gem to paginate records
kaminari
kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs.
kaminari is a Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs.
In this guide you will learn what is the best practices about controllers work and how they fit into the request cycle in your application.
Ruby provide few ways to check object value equality.
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!
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.
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.
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.
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.
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:
Future Value
Scarcity
Substitution Cost