Heading image for post: Learning Ruby on Rails in 2021

Ruby

Learning Ruby on Rails in 2021

Profile picture of Jack Rosa

A Beginner's Perspective

I began my summer internship at Hashrocket with a marginal amount of Ruby experience that I had learned years ago in high school. Most of my programming and development focus has been working with c# and 3D game engines, such as Unity and Unreal Engine. However, I was still eager to learn more about web development and get real-world programming experience. With the support of the Hashrocket team, I got an informative glance into the world of Ruby on Rails development and gained a deeper knowledge of useful coding and testing strategies.

One of the most surprisingly difficult aspects of my internship experience was learning how to be comfortable using the terminal in a development environment. The computer science college courses I have taken occasionally mentioned command-line workflow, but it was rarely involved in the class's curriculum. At first, the command-line seemed insurmountably complex; it was way outside of my GUI comfort zone of using MacOs Finder etc. So while I thought my internship was going to be me breezing through learning the Rails framework, I quickly realized I had a lot to catch up on when it comes to all of the components that make up working in Ruby on Rails; this meant gaining a working understanding of databases and SQL, data fixtures, GIT version control, json, HTTP requests, web hosting, and hundreds of other technologies. Coming from having little experience in any of this, I quickly felt overwhelmed.

I began with Michael Hartl's Ruby On Rails tutorial, which was recommended by virtually every Hashrocketeer. Slowly, but surely, over the next couple weeks the tutorial started to build my confidence by offering a holistic approach to teaching Rails development. Not only does the text efficiently teach Rails development by leading you through building functioning web apps, but it also builds command-line skills and stable version control habits. While the amount of building blocks for any Rails app is still large, Hartl's tutorial helps to connect the dots between all of the moving parts. By the time I finished the tutorial, I felt way more comfortable in the Rails framework, however I also felt that I wouldn't truly gain a deeper understanding of how Rails is used until I tried to build a feature without the help of a tutorial.

Rails first really clicked with me when I finished the tutorial and wrote my first app feature independently. My task was simple: Using the sample app that I built from Hartl's tutorial, I was going to add a way for app users to like each others' posts, a la Facebook or Twitter. While it was certainly not the most advanced feature to build, it was still important because it allowed me to use and strengthen my newly learned skills independently. Once I begun successfully building and testing my own idea (not without trial and error), I realized just how far I had come in the world of Rails web development. Here are just a few things I learned along the way.

My Advice

Expect to fail a lot when learning Rails or any type of programming, I believe that you should actually seek out failure, because every time you fail at implementing code, you are given an opportunity to learn how to do something correctly. This mindset I believe does not just apply to Ruby on Rails, but most other programming skills as well. Also, learn how to efficiently Google search problems that you are having. If you can find the right Google search, you can learn almost anything in programming and you'll quickly find that someone has already experienced and solved the problem that you are facing. Trying things, breaking things, and failing are all integral parts of development, but don't let that discourage you; this is how you learn.

When In Doubt, Code it Out

The Rails console is your best friend. If you are ever unsure why something is not working, spend some time in the console and see if the values of whatever you are looking for are what you are expecting. So many of the bugs in my code have been solved by simply verifying that the code contains the values that I am expecting in the Rails console. Using the console can help you gain a better understanding of what your code does and what it should do. Also, the development gem byebug is extremely helpful for debugging methods. Simply inserting a byebug into any method will insert you into that method in the console whenever the code is ran, allowing you to check on your objects, variables, and data to see what the root of your problem is.

Logs are Your Friend

Whenever something is broken in your app and you have your local rails server running, be sure to check the server logs to gain insight on what is causing your program to break. While this will sound remedial to anyone familiar with Rails development or programming in general, the error messages that you get when something is broken are arguably the most helpful tool at your disposal; these tools are here to help you and point you in the right direction when things aren't working properly.

Whatever You Do, Test it

Whether you are testing your app with rspec or minitest, one of the most important parts of developing web apps efficiently is having good automated test coverage. Why manually check your local server to see if your app works properly when you can simply write a test to do it for you? Luckily, Rails makes testing your app very easy. I recommend reading through this Rails guide on testing to see why testing is so important. Writing good tests can save you a lot of time and trouble when building new features. Testing your code is a good habit to get into early in learning Rails. Michael Hartl's tutorial provides lots of good examples of how to test your code.

The Learning Never Ends

There is never an end to learning Rails development or programming in general, there is only improving your skills and knowledge. While I've learned so much valuable info on Rails development, it's important to remember that no developer is perfect and nobody knows everything; this is why it's important to use the available resources when you get stuck or hit a wall. Something that I learned from the developers that have helped me get my footing with Rails is that good developers are pretty much always trying to learn new things. Development is a fast moving and ever-changing industry; things deprecate and new features are always being introduced.

Conclusion

Rails may not be the newest or most popular web development framework, but it is still extremely well designed, elegant, and intuitive to learn. According to data from PayScale, Ruby on Rails development is one of the highest earning fields in web development. Learning Rails so far in 2021 has absolutlely been worth it for me and I believe it will be for you too and I hope some of this basic advice helps you along the way.

  • Adobe logo
  • Barnes and noble logo
  • Aetna logo
  • Vanderbilt university logo
  • Ericsson logo

We're proud to have launched hundreds of products for clients such as LensRentals.com, Engine Yard, Verisign, ParkWhiz, and Regions Bank, to name a few.

Let's talk about your project