Understanding why and how to add idempotent requests to your APIs

Idempotency is an often used term in computer science. It’s meaning to some might not be known, to others it’s very well known. The explanation for idempotency on Wikipedia is: … the property of certain operations in mathematics and computer science that they can be applied multiple times without changing the result beyond the initial application. Essentially, idempotency is the mathematical way of saying “one can apply a certain operation on something many times, without changing the result of the operation after the first time the operation is applied”....

November 2, 2017 · 21 min · Ilija

How Rails handles status codes

Recently, I have been building an API as part of my day job. Rails is a great framework to build APIs in, and it has been a joy so far. When building the responses of the API, it’s paramount to understand what HTTP statuses you should utilize, which will in return help the consumers by providing more meaningful responses. Sure, you could always have a status property in the response JSON, which will be a human-readable status code....

May 27, 2016 · 9 min · Ilija

Running a Rails Application on Deis

In the last couple of years, we have seen a lot of development in the devops field. It’s becoming much easier for developers to provision servers and deploy their applications on those servers just with a couple of key strokes. Since the start of the SaaS and PaaS products (even before we knew them as that), we have seen a vast number of companies and communities try to make our lives easier by developing smart tools that will fit into our workflow seamlessly....

January 7, 2016 · 2 min · Ilija

Rails, Secure Cookies, HSTS and friends

Ruby on Rails as a framework does a lot of things for us developers. We get a very customizable middleware stack, great routing system, very expressive ORM, helpful modules with great utility methods in them and so on. But in Rails there’s more than meets the eye. It does some great things that we just take for granted or on occasions we don’t even know they exist. Some of these features are TLS redirection, secure cookies and HTTP Strict Transport Security (HSTS)....

December 14, 2015 · 8 min · Ilija

Why and how to test Rake tasks in your Rails application

Most of us write some Rake tasks and completely forget about them. In fact, we rarely give any love to our Rake tasks. Well, I think it’s time we change that. Let’s see why and how we can test our Rake tasks. But, why? Yes, it’s a legit question. You can always say “I already tested my classes!”. But, there are couple of reasons why you should always test your Rake tasks:...

December 3, 2015 · 5 min · Ilija

How to write Rails middleware

In my last two posts about Rack, I wrote about the basics of Rack and how to write middleware. If you have no idea what this is about, I recommend reading the last two posts (in the order above). For the rest of you, carry on - today we will see how to write awesome Rails middleware and how to use it in any Rails application. Rails and Rack play together really nice, so keep on reading!...

July 7, 2015 · 10 min · Ilija

RailsConf 2015 talks that you should watch

Recently Confreaks uploaded a ton of RailsConf 2015 talks on Youtube. Although I haven’t watched all of the talks, these are some of the ones that in my opinion are very worth watching. Keep in mind that this list will grow as I watch more talks over time. So, without further ado… So You Want to Start Refactoring? by @j3foley In this talk, Jillian Foley talks about refactoring. She shares some techniques about how to approach code that you haven’t written and how to easily refactor it....

May 4, 2015 · 2 min · Ilija