Rails and its Ruby dialect

This was originally titled “Rails is not written in Ruby” but based on feedback, I decided to change the title. I’m born and raised in Kraków, a beautiful city in Poland, maybe you’ve heard about it, maybe you’ve even been here. In Poland we speak Polish, which is a really difficult language, it’s actually considered one of the top-10 most difficult languages to learn in the world. In Poland, just like in many other countries, there are regions where dialects are used rather than “the pure” form of the language, and so in my city, we have our own dialect....

February 2, 2022 · 12 min · Peter Solnica

10 Years of Open Source

On June 4th, 2011 I released the first version of Virtus, a ruby gem that I extracted from the DataMapper project. I remember how I felt about Open Source back then, and I have to tell you that my perspective has changed a lot. 10 years, a freaking decade, is a lot of time…I’ve gone through a lot of ups-and-downs during that time, as my open-source contributions sky-rocketed, and that changing perspective is something I continuously think about....

June 4, 2021 · 10 min · Peter Solnica

The 5 Rules of Simple RSpec Tests

The 5 “rules” I try to follow in order to write simple RSpec tests. Let’s GO. 1. Max 2 levels of describe/context nesting Everything above 2 is a code-smell and causes alarm bells in my head to ring. The more levels of nesting you have, the harder it is to understand what a given example is doing. If you add before/after hooks to the mix, it’ll become even worse. I often reduce nesting by simply using example descriptions like that:...

May 11, 2021 · 5 min · Peter Solnica

WHOOPS! Thoughts on Rails, forking and leadership

I decided to let it all out. What a funny coincident because exactly 5 years ago I wrote that I’m leaving Rails for good. I thought I’m gonna leave Ruby too but that didn’t happen and I’m still a very happy Rubyist and because of this I’m really saddened to see what’s been going on the past few days; but HEY, it’s up to us to make something good out of it....

May 1, 2021 · 7 min · Peter Solnica

Fixing Ruby 2.7 compilation error on Big Sur

We’re in the process of upgrading to Ruby 2.7.2 at castle.io and today I had to install it on macOS Big Sur. Unfortunately, I hit a compilation error that looked like this: $ ruby-install ruby 2.7.2 # yada yada yada compiling dmyext.c translating probes probes.d . ./vm_opts.h compiling array.c compiling ast.c compiling bignum.c compiling class.c compiling compar.c compiling compile.c compile.c:9857:61: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING' if (table == NULL) rb_bug("%s: table is not provided....

December 9, 2020 · 1 min · Peter Solnica

Be cautious with Ruby coercion methods

Coercion is a tricky problem to solve and it’s something we need pretty much everywhere. Whether you’re building a web application or a CLI tool, you will have to coerce values in some way. I say it’s a tricky problem because Ruby comes with many builtin coercion methods but it’s not enough. Furthermore, the builtin methods may actually lead to bugs or surprising behaviors. In this article we’ll take a look at the builtin coercion methods, various caveats that come with their usage and ways how you can handle coercion in a more predictable and strict way....

July 29, 2020 · 5 min · Peter Solnica

Introducing dry-schema

Two years ago (!!!) I published a post on discourse.dry-rb.org explaining my plans for dry-validation 1.0.0 and in this post I mentioned that there will be a new gem called dry-schema that dry-validation will use for its schemas. It’s crazy how time flies because I swear I thought it was last year. I know that over this time dry-validation has been accumulating a lot of issues (125 in the moment of writing this article), and I know it sucks, big time, that I didn’t have a chance to address any of these....

January 31, 2019 · 6 min · Peter Solnica

A quick​ recap and plans for the future

Hi, I’m back! I haven’t written anything on this blog since November 2016, which is sad but it is what it is. I’ve got so much to tell you. A lot happened during this time, and I’ll try to summarize it here and also talk a bit about my plans for the future. The Ruby Prize Almost a year ago I was honored to go to Matsue, Japan, to attend the Ruby World 2017 conference, where I received the Ruby Prize from Matz himself....

August 29, 2018 · 7 min · Peter Solnica

Duck typing vs type safety in Ruby

Duck typing is one of the virtues of the Ruby language, it adds a lot of flexibility to the code, and allows us to use objects of different type in places where only specific methods are needed. Even though the idea behind duck typing may seem to be straight-forward, it is easy to use it incorrectly. It’s interesting to notice that over many years we’ve adopted various techniques that seem to leverage duck typing, but the specifics of how exactly we’re doing it are actually questionable, and I believe they deserve some reconsideration....

November 2, 2016 · 6 min · Peter Solnica

Abstractions and the role of a framework

This is a follow-up to the discussion that was started last week after I published “My time with Rails is up”. Since this article received a lot of feedback, over 1000 comments on various sites and even more tweets, despite my greatest efforts, I didn’t manage to reply to everything. Many people were confused about some of the arguments, as I didn’t do a good job at providing proper context and making certain things clearer....

May 30, 2016 · 7 min · Peter Solnica