Ruby on Rails,
and it’s fundamental purpose, and benefits for any Ruby based application…
Rails is a ‘MVC’ ( which stands for ‘model’, ‘view’, and ‘controller’ ) based framework for the object oriented programming language, ‘Ruby’, that is utilized for web development at the ‘server side’ of websites, (or applications). Ruby itself is useful on it’s own and you can learn more about the basics of Ruby in one of my previous blog entries, here. But in short Ruby is a ‘true object oriented programming language’ that makes it possible for developers to create programs with ease due to it’s ‘human readable’ based syntax.
Rails was first invented in 2004, by ‘David Heinemeier Hansson’, along with his team, to create a framework which provided a seamless interaction with language, to shrink down the amount of written code, maintain time-oriented efficiency, and decrease obstruction to the entire development process. Rails extends Ruby to solve problems, without the developer needing to ‘reinvent the wheel’. The main benefits of using Rails from a programmers perspective, are that it’s cost effective (since it can be built quickly), it’s fast (since it comes out the box with ‘ready to use’ plugins and modules, which decreases the time usually needed to write boiler plate code), it’s easy to manipulate or change your existing code, it’s secure (because there are security measures enabled by default within the framework), efficient because Ruby is such a concise language which works well with third party libraries, and there are many Ruby/Ruby on Rails based repositories on GitHub, with developers constantly improving code and building a strong sense of community around the the language itself.
To understand the overall concept and benefits that Ruby on Rails Provides, it’s necessary to understand MVC architecture and why it’s important. MVC makes it possible for there to be a separation between a program’s logic and it’s display. This is known as ‘separation of concerns’, which will allow for improved maintenance since, the work that the application has to do to run, will be divided up throughout the program.
If one has experience with frameworks such as Angular, or Django, they, will have had interactions with MVC based architecture before. This style of programming makes an application very efficient, and easy to update, and also limit complexity even after the program scales, and grows in it’s amount of users. Shopify is a great example of this, with it’s millions of businesses that utilize it’s (Ruby on Rails) software.
The view is the part of the program that displays the data within. A view grabs the data from the model after requesting it.
The controller will handle the users interactions with the program, that includes things, like keyboard and mouse inputs. The controller will tell the model how to manipulate the view, (in other words, the controller updates it’s ‘state’).
Get Royce Taylor’s stories in your inbox
Join Medium for free to get updates from this writer.
The Model holds all of the data as well as any logic associated with said data. This data will only change if it’s acted upon by the controller, otherwise it will maintain the same data, which will be presented to the user in the view.
To get started with Rails you need to install it onto your system with this link here. You will also need git bash and a text editor of your choice, as well as having node installed onto your system. Once you have everything installed, find the file in your system and open it with a git bash terminal. You can check your versions to confirm your installation, and once you have done so, you can run “rails new <name of your application>” which will then create the entire application with all of the boiler plate code needed to build an application. The basic CRUD (create, read, update, and destroy) operations will be implemented already along with the necessary templates for your basic views, models, and controllers. When you need to add another feature to your application. It will default with certain technologies out of the box, such as SQLite for the default database, but any of these can be changed if need be. The gem files are similar to “package.json” files which will hold all the dependencies needed for your program to operate. When you want to add another feature, it’s as simple as another git bash command, which will then generate all of the files that contain the boiler plate for your models, views, and controllers for said feature. Then all you need to do as a developer is tweak these files (with Ruby syntax of course) in the manner that you need for your application. You can even apply style sheets to any views just like you would with any other web development framework.
As one could see, this initial setup is quite simple and starts any developer off with the proper tools, and boiler plate code to launch their ideas off of, in whatever capacity that may be. There are plenty of tutorials that get more into the meat and potatoes of the code base/syntax with Ruby on Rails, which I’ll source below. Ruby on Rails is a great, and trusted way to build any sort of successful application.






