Is ActiveJob the best way to call external APIs – and how do I show the results in the UI?

by Comments Off on Is ActiveJob the best way to call external APIs – and how do I show the results in the UI?

So you’re fresh off a Node JS project and you’re all excited about how Node returns information back to the client immediately. Node isn’t all bad – that new-fangled ES6 is pretty good although the tooling still confuses me in places. And then you head back to Rubyland and start working on a Rails project…. Continue reading

You know your problem? You do too much…

I’ve been a professional software developer for twenty years now. There’s been one idea I’ve been reading about for about fifteen of those years, but it’s only in the last couple that it’s really come home to me how important it is. And it’s really, really simple. How can you make it smaller? The feature… Continue reading

They said “just use a PORO” but I don’t know what that is

Does this sound familiar? Asking for advice on a forum – “I’ve got a bulk update task for my database and I’ve read that I shouldn’t put that sort of thing into a migration – what’s the best way to do it?” And the reply came back – “Just use a PORO”. I looked it… Continue reading

How do you read other people’s code?

When you’re starting out, one of the best ways to learn is by looking at code written by more experienced developers; especially when it comes to learning key concepts like “the Rails Way”. But where do you begin? It can be a struggle to figure out how a particular app works when you have loads… Continue reading

What is Monkey-Patching?

As you read about Ruby you’ll often see the term “monkey patching”. It’s used all over the place by experienced Rubyists but it’s one of those dangerous things that is very easy to misuse or abuse. So if you’re confused about what it is, here’s a quick explanation: Ruby is an extremely dynamic language. That… Continue reading

What is duck-typing?

You often hear Rubyists talking about “duck-typing” But what is duck typing? What do ducks have to do with ruby anyway? In many programming languages, each object, or variable has a static type. By static, we mean it is determined at the time that the code is compiled. So you define variable s as a… Continue reading

Why is to_s not returning an object ID and not what I told it to?

to_s is one of the most useful methods in Ruby. Almost every class you ever write should have an implementation of it; it’s useful when debugging, it’s useful when outputting information for people. But sometimes you call puts @my_object and it ignores your to_s method and just returns the object ID; something like #<C:0x0055ff9f85ba48> Why?… Continue reading

What’s the difference between order and sort?

ActiveRecord does some amazing stuff (sometimes). It takes a relational database and then maps it to ruby objects – a task that’s not trivial, as object-orientated design doesn’t really map well to good database design. But sometimes you need to be aware of what ActiveRecord is doing and where it’s doing it … For example,… Continue reading