The highly effective Ruby on Rails web application framework was created by David Heinemeier Hansson. To understand this tutorial, you will need a working knowledge of both Ruby and object-oriented programming from the Ruby on Rails Course. You also need to be knowledgeable about general website programming and the internet.
A framework is a software, a collection of programs, or a library of code that creates the majority of your application on your behalf. Your task while using a framework is to write the components of the program that cause it to perform the tasks you require.
Leaving aside the setup and other housekeeping duties, there are three main tasks you must complete when developing a Rails application:
• The domain of your application is the scope of your application; describe and characterize it. The website could be a hardware store, music store, university, dating service, or address book. You must ascertain what is inside, what beings are present in this universe, and how the components of it interact. The entities and their relationships are maintained by modeling a database structure in this manner.
• Define the possible outcomes in this domain. The domain model is static; it needs to be made dynamic. An address book can contain addresses. In music stores, you can buy musical scores. Users of a dating service can sign in. A university has a registration process for students. You must list every situation or action in which the components of your domain might take part.
• Choosing and creating the domain's publicly accessible views is where you may begin to consider web browsers. You can picture a welcome page, a registration page, a confirmation page, etc. if you've determined that your domain has students and that they can register for classes. Each of these pages, or views, provides the user with an overview of the situation at a specific time.
Ruby on Rails utilizes an MVC framework based on the three responsibilities.
Ruby on Rails MVC Framework
Three distinct yet closely collaborating subsystems make up an application's work according to the model view controller approach.
Model (ActiveRecord )
It manages validation, association, transactions, and more while maintaining the connection between the objects and the database.
This subsystem is implemented in the ActiveRecord library, which acts as a bridge and binding between the Ruby program code that manipulates database records and the tables in a relational database. The field names of database tables are automatically used to create the names of Ruby methods.
View ( ActionView )
It is the presenting of data in a specific format as a result of a controller's choice to do so. They can be very easily integrated with AJAX technology because they are script-based template systems like JSP, ASP, and PHP.
The ActionView library, an Embedded Ruby (ERb)-based system for specifying presentation templates for data presentation, implements this subsystem. A view is shown after each Web connection to a Rails application.
Controller ( ActionController )
The capability within the application that guides traffic, on the one hand, asks the models for particular data, and on the other, arranges that data (searching, sorting, and sending it) into a form that suits the demands of a certain view.
ActionController, a data broker positioned between ActionView and ActiveRecord (the database interface), is where this subsystem is implemented (the presentation engine).
Top comments (0)