Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Understanding the MVC pattern is key to understanding Rails. MVC divides your application into three layers, each with a specific responsibility.

The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic that is specific to your application. In Rails, database-backed model classes are derived from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and embellish these data objects with business logic methods. You can read more about Active Record in its README. Although most Rails models are backed by a database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as provided by the Active Model module. You can read more about Active Model in its README.

The Controller layer is responsible for handling incoming HTTP requests and providing a suitable response. Usually this means returning HTML, but Rails controllers can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and manipulate models, and render view templates in order to generate the appropriate HTTP response. In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and controller classes are derived from ActionController::Base. Action Dispatch and Action Controller are bundled together in Action Pack. You can read more about Action Pack in its README.

The View layer is composed of "templates" that are responsible for providing appropriate representations of your application's resources. Templates can come in a variety of formats, but most view templates are HTML with embedded Ruby code (ERB files). Views are typically rendered to generate a controller response, or to generate the body of an email. In Rails, View generation is handled by Action View. You can read more about Action View in its README.

Code Quality Rank: L2
Monthly Downloads: 3,764,215
Programming language: Ruby
License: MIT License

Ruby on Rails alternatives and related gems

Based on the "Web Frameworks" category

Do you think we are missing an alternative of Ruby on Rails or a related project?

Add another 'Web Frameworks' Gem

Ruby on Rails Recommendations

There are no recommendations yet. Be the first to promote Ruby on Rails!

Have you used Ruby on Rails? Share your experience. Write a short recommendation and Ruby on Rails, you and your project will be promoted on Awesome Ruby.
Recommend Ruby on Rails

Recently added Ruby on Rails resources

  • New week new bug to hunt down! A day after our last deployment at work, a new type of error started rising like a great wave. Random SQL update queries started failing at random with the following error:
    ActiveRecord::StatementInvalid: Mysql2::Error: Lock wait timeout exceeded; try restarting transaction: UPDATE users SET ...
    Article  Added by tothpeter // blog.kalina.tech // about 17 hours ago
  • In this case study, I interviewed Trevor Hinesley about Soundstripe and Filepass, two startups that he co-founded, both of which run Rails applications on DigitalOcean with Cloud 66. Find out how these companies achieved DevOps best practices with our tools.
    Article  Added by Kasia66 // blog.cloud66.com // 5 days ago
  • Storing sensitive data in plaintext can seriously harm your internet business if an attacker gets hold of the database. Encrypting data is also a GDPR friendly best practice. In this tutorial I will describe a simple way to securely encrypt, store, and decrypt data using built in Ruby on Rails helpers instead of external dependencies.
    Tutorial  Added by pawurb // pawelurbanek.com // 7 days ago
  • I collected the experience and the lessons I learned during the process of upgrading Rails from 3.2 to 4.2 along with some undocumented changes and solutions for them.
    Article  Added by tothpeter // blog.kalina.tech // 8 days ago
  • In the darkest corners of every app development process dwell lines of code that make even the bravest of developers wake up at night drenched with sweat. There are rumours around the team that business people will soon come to demand some changes in that particular part of the abyss. People are trembling with fear, dropping their cups, spilling coffee and asking for remote work – all in a bid to avoid the impending catastrophe.
    Article  Added by Beata // naturaily.com // 27 days ago
  • Choosing Ruby On Rails For Your Next Web Development Project is
    the 70 pages long single resource on Ruby on Rails covering all the main topics related to the framework. Written from a business perspective, aimed to help product owners, startup founders, and c-level executives make better decisions when it comes to web development.
    Article  Added by mreyman1990 // bit.ly // about 2 months ago
  • Write simple HTML polling using Ruby on Rails ONLY.
    Article  Added by nikolalsvk // medium.com // 2 months ago
  • In this tutorial you'll learn every possible way to write a loop expression in Ruby. This is key for any Ruby developer to understand & write good code.
    Tutorial  Added by jesus_castello // www.rubyguides.com // 2 months ago
  • Using StimulusJS controllers, adding nested forms to a Rails application is easy and unobtrusive. In this episode, we look at an alternative way of creating nested forms without the Cocoon gem.
    Tutorial  Added by kobaltz // www.driftingruby.com // 2 months ago
  • Tutorial  Added by ShivangiCometChat // www.cometchat.com // 2 months ago