An intro to Ruby on Rails

Daniel Kim
2 min readApr 29, 2021

Ruby is a backend programming language that was publicly released in 1995 and created by Yukihiro “Matz” Matsumoto. Whereas Ruby on Rails is an open-source web framework. Ultimately, Ruby on Rails is a Ruby gem with a set of Ruby code libraries.

Some of the reasons why a person may want to use Rails is that it is extremely productive and makes using Active Record much more efficient. This is possible because the Rails framework uses many metaprogramming techniques, thus the user can save a ton of time by not having to write out a bunch of code that they would have to with only Ruby. For example, with Ruby you would typically need to create migration tables and create models separately, but with Rails you can create both models and tables simultaneously with one simple generate model terminal command. Other benefits include that Rails use convention over configuration, meaning that if you follow the suggested naming conventions, you can save a lot of time without writing configuration code.

Rails takes use of the model-view-controller architecture, or MVC. A common example to think of MVC is to think of the model as a chef, the controller as a waiter, and a view as a customer. Models are class files that hold the methods for the application. Similar to how a chef performs tasks to create a meal, the model file has our methods and actions. Just as a waiter takes orders from the customer, relays that order to the chef, and then brings the meal to the customer. Controllers relay and interpret all user actions between the models and views. Customers do not interact with the chefs, they place orders and receive their meals all through the waiter. All the view does is receive the methods and actions from the controller and renders that data. The MVC allows for a simple way to follow user actions and the flow of data.

Thanks for reading!

References

https://www.rubyguides.com/2018/10/what-is-ruby-on-rails/

https://www.tutorialspoint.com/ruby-on-rails/rails-introduction.htm

--

--