My First Contribution to Rails
And how you can too!
Contributing to Ruby on Rails can often feel intimidating.
You might think to yourself, "Wow there are all these smart people working on a great framework. What could I possibly contribute?"
Yes Ruby on Rails is a wonderful framework. But at the end of the day, it is written by humans and software written by humans have bugs.
If you are a junior engineer still learning how Ruby on Rails works, I would still focus on learning how to use the framework. But if you have more than 3 years of experience working with Rails, I suggest you give it a try!
How I got started
I found myself in an awkward gap in employment. I already had my last day at my last job, but my new job didn't start for 2 weeks. I felt it was the perfect time to do something I always wanted to do, contribute to Rails!
I began my search browsing through Github Issues.
Honestly a lot of issues that were posted felt were beyond my abilities.
My goal wasn't to do something major, I just wanted to fix something and some of my own code in Rails. Nothing major.
That was when I discovered this issue: https://github.com/rails/rails/issues/41265
The TLDR is:
If you specified a path for a file that doesn't exist, Rails will always send an error saying that the absolute path should be specified.
If you're specifying a relative path, then this error could make sense. But this error incorrectly shows up even when you specify an absolute path.
Forking the repository
Don't be intimidated by this button. Click it and get yourself a forked version of Rails on your personal Github.
Once I cloned the repository, I began my investigation.
I ran a 'search all' of the error message to quickly find the culprit in
If the file was present, it would return the file. Otherwise, it would send this error message without even checking if it was an absolute or relative path.
I updated the code to check if the path is absolute or relative.
Sweet we're done!
Always write your tests!!!
The test framework that's included automatically with Rails is really where it shines. Without tests, we'd just have software that's breaking all the time.
Here I tested the different paths.
I opened up my Pull Request full of excitement!!!
I also went back to the original issue and let the reporter know that "I took care of this."
I read from other blogs that you should be patient as the Ruby on Rails contributors are really busy. So I patiently waited.
A day turned into a week...
A week turned into a month...
A month turned into 3 months and then...
This message showed up! :(
By this time, I was knee-deep in my new job. I was a little bummed that my Pull Request got ignored but that's okay I was busy with my job.
Yesterday I realized what the rails-bot was saying on the issue page.
That if the issue still persists, then you should say something so the issue stays open.
I realize the core contributors are very busy people, so gave them a little nudge.
Not too long afterwards, I was ecstatic to see this show up in my email.
So there you have it folks!
I'm sure many of you reading this are thinking, "I could've done that!"
"Yes you can!"
Not every bug or feature in Rails is super complex. You can do your part in helping Rails evolve and dependable.
If you ever find yourself inspired to contribute to Rails go take a look at Github issues and see if there is something you feel like you could tackle. Or if you find a bug in Rails on your own, don't write a monkey patch in your application. Go take shot at fixing it at it source!
You could be part of the exclusive club of just 4,287 people.
Plus you get this sweet badge that says "Contributor" for some street cred.
I've made a living off Ruby on Rails for my entire 7 years of programming.
Rails has given me so much pleasure and joy working with software. It was time for me to give back, however little it may be.
Is it time for you as well???
A very special shoutout goes to Eileen Uchitelle for providing guidance through this Rails talk.