Ruby to Rails Evolution

Alex Sahli
4 min readSep 28, 2020

--

When most people start to take on a hobby, they usually don’t start with the best tools or equipment to tackle it on a high level right away. Theres always a learning curve, a process to go through. As the simple things become more familiar, trying to advance means first focusing on minutiae and picking apart the details, then applying them while learning more complicated concepts.

With coding, its similar, but opposite. First I learned things that focused on the smallest pieces of data, then they turned into something larger: hashes and arrays. Still larger then, they became objects. Finally our objects could interact with each other in a system.

How could it stop there, though? SQL and Active Record made those interactions persistent, and I could create barebones apps with Ruby and AR. From there I got into Rails, where I’m at now. Here we’re going to talk about the jumps from Ruby to Rails and how things became more complicated while somehow also being streamlined.

Ruby Object to Active Record to Rails

These have come a really long way. When I created a Ruby object initially, I would have first created a reader and a writer method. Then I moved onto attr’s reader/writer/accessor which would essentially replace that code except for special cases. When Active Record came into play, we moved onto migrations and schema, where we would create tables to represent our objects, and our models would call on those tables and reference them. Now that I’m in Rails, I generate most models, as well as their controllers. If I need to add or remove an attribute (column), its a simple rails command away. I have to manually write out Routes and Views now, as well as create forms, but those let me have a visual representation of whatever I specify through my local host.

How Data Behaves At Each Stage

At first, I was selecting at individual strings, integers, booleans, and floats from an array. Once I moved onto creating Objects I could use ‘pry’ to stop my app and inspect each value of my object. When I made the change to Active Record, it gave me tables of persistent data related to objects that I could create insights from. After I learned that, I was able to make an app where a user could create objects that related to already existing objects, and their relationships to other objects of the same type, and even existence as an object, were dependent on their attributes. Through that app I was able to, as a user, parse that date in a clean, legible format. Rails takes that to a different level: I can view all the data on my local host as a webpage almost instantly, which brings me to the last evolution I noticed…

Visual Representation

Learning to code was extremely frustrating until I could really understand what was being shown to me, and why. First starting out in Ruby, I would work in my IRB or a REPL and my terminal. That would continue on for quite a while, through Active Record, until I made an app which had graphics, password prompts, menus, and forms. As soon as I got into Rack, not even Rails, I realized the power of the library I was using. I am mostly a visual learner, and having data represented in a browser, dynamically, makes my life a lot easier. I’m recognizing how all the pieces fit together and when to use tools like Byebug, which is kind of like a beefed up Pry. I’m trying to look at HTML and CSS as ‘gems’ as well, like Catpix and TTYPrompt. They’re powerful tools to add functionality to my app and display data to my clients within the functionality of the web app.

Evolve Or Be Extinct

I now know the true meaning of a ‘stack’. It has become extremely obvious that I’ve learned to make a screw first, and now I’ve moved up to building a log cabin. Understanding the process and progression is key to creating as opposed to just doing. Its the difference between knowing that something works and knowing *why* it works. Love the process even if that means every nil value that should have an id attached to it.

--

--

Alex Sahli

Brooklyn based, interested in software development.