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. It’s not too different from Polish, but we have our special words, and a special way of saying certain words. For example, we say “czy”, which means “three”, even though the correct form is “trzy”, but we’re like “that’s too hard” so we keep it simple, “czydzieści czy” (33) instead of “trzydzieści trzy”. The rest of Poland is making fun of us because of this kind of stuff, but whatever, it’s our dialect - this is how we like to speak. ...

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. I don’t know how many projects I contributed to, how many libraries I’ve written, I honestly do not know. ...

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.", RUBY_FUNCTION_NAME_STRING); ^ compile.c:9859:63: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING' rb_bug("%s: index (%d) mismatch (expect %s but %s).", RUBY_FUNCTION_NAME_STRING, i, name, table[i].name); ^ 2 errors generated. make: *** [compile.o] Error 1 !!! Compiling ruby 2.7.2 failed! After some digging I managed to solve this problem by doing the following: ...

December 9, 2020 · 1 min · Peter Solnica

Open Source Status Update - August 2020

Hey y’all! It’s time for another OSS update. I was quite busy with my “normal work” in August so unfortunately I didn’t manage to work on rom-rb like I planned. I focused mostly on dry-rb maintenance work and growing my YouTube channel. OK let’s see what happened! Saying “good bye” to dry-web! That’s right! We officially discontinued our work on dry-web as well as dry-web-roda, which was its companion gem that integrated Roda with dry-web. ...

September 4, 2020 · 3 min · Peter Solnica

Open Source Status Update – July 2020

In July I went on holidays and had quite a busy month at my day job but nevertheless I’ve managed to push things forward. Here’s a summary of what happened! New dry-validation releases We’ve had two bug-fix releases of dry-validation. Just like in case of a couple of previous releases, there were a bunch of really nice PRs from contributors which is lovely 😄 In 1.5.3 I’ve fixed a new bug that was discovered recently where using key? helper inside a rule would crash in case of a deeply nested data structure that has nested arrays. In general, even after few years of development we keep seeing bugs related to complex data structures. I always need to remind myself that the number of use cases is gigantic and it’s going to take a while until we see fewer (or even no) bug reports similar to the one I mentioned. ...

August 6, 2020 · 3 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

Open Source Status Update – April - June 2020

It’s finally time for another Open Source Status Update! This one’s different as it covers last three months. Due to pandemic situation and having my kids at home, including online schooling, it was really difficult to do any OSS hacking. We’ve got some things done regardless in March and April thanks to support from our contributors, so I also would like to use this as an opportunity to thank you all for your help! ...

July 9, 2020 · 5 min · Peter Solnica

Open Source Status Update - March 2020

It’s time for my second Open Source Update :) This one covers March 2020. As you can probably imagine, last few weeks were very challenging due to pandemic. I tried to push things forward regardless but I didn’t manage to accomplish everything I planned. dry-schema & dry-validation 1.5.0 You can read the official announcement right here. I’m very happy with both releases, especially that they brought many new features that a couple of years ago would be really hard to implement, but now it was relatively easy to achieve. The schema composition feature is a good example of this, even though it’s marked as experimental and not all details are fleshed out yet (like error message format for exlusive disjunctions), what already works is an advanced piece of functionality! ...

April 3, 2020 · 4 min · Peter Solnica