Rails ActiveRecord Relation (Arel), composition and Query Objects

Ruby on Rails ActiveRecord::Relation (or Arel) is really handy tool to create complex SQL calls. In this article I'll show you several tricks I've came across over the years and show you how to combine them to Query Objects and Query Interfaces

Published February 27, 2017
View Blog

POST != Create and PUT != UpdatePOST

Ruby on Rails developers tend to think that HTTP method POST represents Create and PUT means Update. Well, not really. The CRUD mapping of modern web-frameworks just limits the scope of this HTTP methods for sake of simplicity in code design. Read more in this article what they really stand for.

Published February 05, 2017
View Blog

PATCH vs PUT and the PATCH JSON syntax war

There is still lot of confusion on PUT vs PATCH HTTP methods and the JSON syntax. In this article I will try to explain the difference and present pragmatic solution to PATCH syntax problems.

Published December 12, 2016
View Blog

Setting up Ubuntu 16.04 for Ruby on Rails app (Cheatsheet)

Quick cheatsheet how to install various technologies for Ruby on Rails application under fresh Ubuntu 16.04 machine

Published November 15, 2016
View Blog

Set up AWS Elastic Beanstalk

In this article I will show you how to Set up AWS Elastic Beanstalk Docker environment, RDS, ElasticCache and Security Groups for demo Ruby on Rails application.

Published November 15, 2016
View Blog

How to configure Route 53 to Cloudflare

How to properly set up Cloudflare with Route 53

Published October 10, 2016
View Blog

Various CORS issues related (not only to) Ruby on Rails

CORS may be bit tricky (not only) for Ruby on Rails application. In this article we will have a look on some problems and solutions I've dealt with.

Published October 04, 2016
View Blog

Simple Authentication for one user in Rails

In this article we will bulid simple session based authentication for one user for Rails from scratch.

Published September 29, 2016
View Blog

Pure RSpec JSON API testing

In Ruby on Rails there are many tools how to test your JSON API, but you don't necessary need to install any gems. RSpec provide really decent tool set for many scenarios including APIs

Published August 22, 2016
View Blog

AWS ElasticBeanstalk deployment hooks

How to run post and pre deployment scripts on AWS Elastic Beanstalk running (not only) Docker environment

Published August 22, 2016
View Blog

Ruby Enumerable, Enumerator, Lazy and domain specific collection objects

Ruby has couple of nifty tricks up its sleeves to deal with collection objects so that they map your domain. In this article we will look on Enumerator, Lazy Enumerator and Enumerable and how to implement API collection objects in Plain Ruby so that they can be used in similar way as you would use Rails scopes

Published August 02, 2016
View Blog

RSpec be_within matcher

RSpec 3 be_within matcher for comparing values in delta range

Published June 30, 2016
View Blog

Rendering Paperclip url via Elasticsearch without making calls to ActiveRecord DB

Rendering Paperclip attachments / urls vith Elasticsearch without ActiveRecord calls.

Published June 29, 2016
View Blog

Common AWS Elastic Beanstalk Docker issues and solutions.

Several debugging tricks for AWS Elastic Beanstalk runing Docker

Published May 12, 2016
View Blog

Some debugging tips for Ruby on Rails

Several debugging tricks for Ruby and Ruby or Rails developers

Published April 12, 2016
View Blog

Spring Cleaning for WebDevelopers

After while our machine, Github, server, ... gets piled with old unneeded stuff, here are sme tricks & commands I use for Spring Cleaning in my machine

Published March 02, 2016
View Blog

Different ways how to do contextual Rails validations

Ruby on Rails has a decent way how to ensure that invalid params won't end up in DB. Problem with Rails Validators is that they are bound to a class rather than Instance object. In this article we will have a look on few workarounds to do context validations.

Published February 28, 2016
View Blog

Rails redirects to wrong host (NginX HTTP_X_FORWARDED_HOST)

Problem I had where NginX was passing wrong HTTP_X_FORWARDED_HOST to Rails and me spend several hours debugging.

Published February 02, 2016
View Blog

Ergonomics and faster typing practices for Web Developers

Ten Finger Typing Technique, Dvorak layout, Split Keyboards and Vim. All this are Techniques and Life Hacks that can improve your productivity and development experience.

Published February 02, 2016
View Blog

Setting up simple Wordpress deployment with CodeShip to AWS EC2

This article will show you a simple way how to set up deployment of a WordPress website via CodeShip

Published January 16, 2016
View Blog

Chromebook for Web Developers

You don't need expensive laptop to be a web-developer or sys-admin guy, all you need is an attitude to get things done. In this article I'll give you my experience on developing commercial web-application backend via chromebook

Published January 12, 2016
View Blog

Build Docker images on your machine or in the cloud ?

Docker images can be build either on local computer or via hosted build servers. Although we all are fans of cloud automation, should we really let hosted solutions build the images for us? Isn't that against Docker philosophy?

Published January 10, 2016
View Blog

Scissors Rule in coding

In coding / software-developing world a rule called Scissors Rule exist several years. Funny enough I couldn't google single article about it :) . In this article I'm summarizing it's base principles

Published August 13, 2015
View Blog

cron rbenv bundle exec rake task

Ruby provide so many easy ways how to create a scheduled job (Whenever gem, Daemons gem, ...) but what if you want to configure something really simple with plain cron along rbenv?

Published July 02, 2015
View Blog

config.force_ssl is different than controller force_ssl

Rails provide option force_ssl as a global seting and as a controller method. They act the same way in terms of redirect to https but have a huge security affect on cookie security.

Published May 08, 2015
View Blog

Ruby Ancestors, Descendants and other annoying relatives

In Ruby is easy to pull "ancestor" classes of a class. However once developer want to work with "descendants" he may find it's not that easy. This article is providing a way how to look at Ruby ancestor tree

Published April 23, 2015
View Blog

JSON array in html element data attribute

How to pass JSON to HTML element data attribute

Published February 20, 2015
View Blog

RSpec matchers in db:seed file

There is overall confidence that seed files (rake db:seed) don't need any additional testing. But in this article I will show you easy way how to add simple layer of tests during the seed process.

Published June 02, 2014
View Blog

Translating locales for Rails model errors

Proper way how to translate Rails validation messages

Published May 29, 2014
View Blog

Mail interceptor for different Rails environments

Rails mail interceptor to prevent sending emails from being sent for different environments using custom environment configuration options.

Published May 21, 2014
View Blog

RSpec performance improvements with before allExample

Improve your test-suite performance by properly using before(:all), after(:all) RSpec hooks so that you trigger less database queries.

Published May 19, 2014
View Blog

Render image with Rails controller

How to stream images with Ruby on Rails controller so that you can fake that images are located on your server.

Published May 19, 2014
View Blog

Jenkins CI for Rails 4, RSpec, Cucumber, Selenium

Jenkins CI to test your Rails app with RSpec Cucumber (Spinach), Selenium and also doing tested deployments.

Published April 15, 2014
View Blog

Temporary enable dalli store in RSpec specs

Ideally when you're running tests you don't want to cache anything, but there are some cases that you need to make sure stuff is working with caching enabled. This article will show you how to temporary enable Dalli cache for some of your specs

Published April 14, 2014
View Blog

Installing rbenv on Ubuntu machine

set up rbenv on Ubuntu

Published March 03, 2014
View Blog

Installing Nginx 1.4.4 from source on Ubuntu 12.04 (Precise)

Step by step manual to install NginX on Ubuntu 12.04 (Precise) from source with SNI support without headache.

Published February 28, 2014
View Blog

Shoulda matchers depricated. Now what ?

Thoughtbots team behind gem shoulda_matches have decide to depricate several matchers in version 2.0. Lot of people still find them useful. Read more to see alternatives.

Published January 16, 2014
View Blog