Memoization in Ruby

This tutorial will help you understanding Memoization pattern in Ruby. Memoization is different from Lazy Initialization. Rails had Memoize to support memoization pattern which will be discussed as well. What is Memoization? Memoization can be used to initialize a variable and store it with the result of some computation that is expected to give same result if computed […]

Integrate ActiveAdmin with Rails

This tutorial will help you integrating ActiveAdmin with Rails 4+ project. ActiveAdmin is open source administrative framework for Ruby on Rails. Source: Github Source Website: ActiveAdmin Website What is ActiveAdmin? As described ActiveAdmin is open source administrative framework that can be used with Rails framework. ActiveAdmin is helpful for content management by creating admin users. And giving them access to features […]

Difference between to_s and inspect in Ruby

to_s vs inspect

While running a script in Ruby, we usually want to log data from objects for debugging purpose. puts, p, logger methods are used to log along with to_s, inspect methods to log object. This tutorial will give brief about each method and when to use which one.   1. to_s to_s is very common method used by Ruby […]

Access specifiers in Ruby

This tutorial will discuss how to define Access specifiers in Ruby and what do they mean for classes and modules where they are being used. Default Scope Whenever you define a new method in any class/module the default access specifier that Ruby will use is public. Thus, all methods defined without any scope are public by […]

Profiling Rails Apps with Rack-Mini-Profiler

rack-mini-profiler

This tutorial will discuss profiling Ruby on Rails Applications using rack-mini-profiler gem. rack-mini-profiler gem helps finding performance bottlenecks by showing speed badge on every page which can be configured to be displayed in particular environments. E.g. development/staging/production environment. How to Install You can install Rack-Mini-Profiler gem by command - gem install rack-mini-profiler This command will help you install […]

Rails Pluck vs Select and Map/Collect

In Rails, Pluck vs Select can be understood while active record querying. Pluck is used to get array of particular attribute based on particular condition. Same can be obtained using select and then collect on model. This tutorial will help you understand the difference between these ways of collection of specific attribute values. We will […]