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: 4,277,254
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

  • Ruby on Rails is almost 15 years old but it’s nowhere close to passing on from the world of programming. While no longer among the most popular, Ruby on Rails is still widely used in 2019, offering maturity, stability, and high code quality. Let's see what else makes this a good choice for your app.
    Article  Added by JoannaStaromiejska // hi.monterail.co // 7 days ago
  • A humorous look (an attempt at least) at explaining the various ways of getting your Javascript into Rails with the new Webpacker gem: Webpack, Webpacker, and Modules, Oh My! How to Add Javascript to Ruby on Rails
    Article  Added by blackninjadojo // blog.blackninjadojo.com // 21 days ago
  • Overview of notable features coming soon in Ruby on Rails 6.
    Article  Added by kobaltz // www.driftingruby.com // 21 days ago
  • Learn to engage the ruby community and promote your own ruby gem to reach across to more developers
    Article  Added by pineapple-content // hashnode.com // 2 months ago
  • Implementing various methods of caching in Rails is relatively simple, and in most basic cases Rails handles cache invalidation out of the box or with minimal code. But when using many-to-many associations, propagating changes in one object to all its associated objects needs some setting up so that Rails can handle cache invalidation. In this article, I talk about various methods of achieving this, and why one should choose on over the other.
    Article  Added by evrimfeyyaz // evrim.io // 2 months ago
  • With Rails 6.0 is around the corner, Action Text has been merged into the Rails repository. However, it can still be used on a Rails 5.2 application while we wait for its official release.
    Tutorial  Added by kobaltz // www.driftingruby.com // 2 months ago
  • Write sandboxed rake tasks that rolls back any changes you made to the database upon exit.
    Article  Added by manojmj92 // medium.com // 3 months ago
  • After using Heroku for years, I wanted to give AWS Elastic Beanstalk a try. My experience during deployment was less-than-stellar, so I wrote a tutorial on deploying a Rails 5.2 / PostgreSQL app on AWS Elastic Beanstalk to help others who might be in the same situation I was.
    Tutorial  Added by evrimfeyyaz // evrim.io // 4 months ago
  • How many times have you, while investigating an (admittedly rare ;)) production bug, stumbled upon an exception backtrace that just doesn't have enough information? For example, an exception gets reraised, destroying the original backtrace with it. So now your logs say that your AI failed to take over the world with AIEpicFailError (great, you already know that), but not why (Timeout::Error while connecting to stackoverflow.com).
    Article  Added by Kasia66 // blog.cloud66.com // 4 months ago
  • This is an article showing how developers can bring their testing and documentation infrastructure to the next level
    Article  Added by Blackening999 // startupcraft.io // 4 months ago