Using ActiveModel::Dirty for tracking changes
ActiveRecord
comes with a mechanism to track changes to your model with ActiveModel::Dirty
. Lets put it to some use.
Initializing Arrays in Ruby
A new array can be created by using two different ways in ruby and can contain different types of objects.
Custom Inquirer Similar To ActiveSupport's StringInquirer
This is in continuation with the ArrayInquirer post.
Lets see how to implement a Custom Inquirer
for a Rails model
similar to ActiveSupport StringInquirer and ArrayInquirer
.
Headless Browsing using Poltergeist
Avoiding a third party redirect can be solved with simulation of user browser actions.
Extend Core Classes in Rails
In my previous post, I have explained how to extend ActiveRecord::Base
.
In this post, I will explain how to extend core ruby
or rails
classes in rails
.
Using Decorator Design Pattern in Ruby
The intent of decorator design pattern, as described in Design Patterns by the Gang of Four
is to
attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
Speedy array operations with Ruby 2.4
Ruby 2.4 has optimized Array#min
and Array#max
methods. Here are some benchmarks.
Calling a binary of a specific version of a gem
I never knew this exisited. It seems it is not documented anywhere and I have no idea how it works, but yes: