59,089
stars
+7
23,114
forks
2,355
watchers
40,406
prs
18,750
issues
172
releases
122
discussions
README
Welcome to Rails What's Rails? 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: Model, View, and Controller, each with a specific responsibility. Model layer The _Model layer_ represents the domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic 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. 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. View layer 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. Controller layer 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. Frameworks and libraries Active Record, Active Model, Action Pack, and Action View can each be used independently outside Rails. In addition to that, Rails also comes with: - Action Mailer, a library to generate and send emails - Action Mailbox, a library to receive emails within a Rails application - Active Job, a framework for declaring jobs and making them run on a variety of queuing backends - Action Cable, a framework to integrate WebSockets with a Rails application - Active Storage, a library to attach cloud and local files to Rails applications - Action Text, a library to handle rich text content - Active Support, a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails Getting Started 1. Install Rails at the command prompt if you haven't yet: bash $ gem install rails 2. At the command prompt, create a new Rails application: bash $ rails new myapp where "myapp" is the application name. 3. Change direct
Top issues
#20676accepts_nested_attributes_for breaks the uniqueness with scope validation76 comments · 2015-06-23#31228Rails Router Catchall Picks Up ActiveStorage Routes49 comments · 2017-11-25#52459Enhance bin/dev to run server in foreground AND still use foreman48 comments · 2024-07-31#14358Rack::ETag middleware doesn't play nice with Live streaming when commit! is called before write46 comments · 2014-03-12#40855`ActiveStorage::Current.host` not set causing disk service to throw `URI::InvalidURIError`37 comments · 2020-12-16#44312ActiveRecord::Sanitization::ClassMethods#sanitize_sql surrounds Numerics with quotes32 comments · 2022-02-02#49604Rails 7.1: incorrect path when submitting form for a singular resource31 comments · 2023-10-12#44800Too much magic in `Rails.logger` and logging to `STDERR` causes duplicate output.29 comments · 2022-03-30
Discussions
#59049Proposal: Detect external side effects inside Active Record transactions0 comments · 2026-10-13#58942Support optional counter caches for polymorphic associations.0 comments · 2026-10-05#58831Put the most used Rails features into a starter kit like Laravel starter kit0 comments · 2026-09-20#58657Deprecate DescendantsTracker?2 comments · 2026-09-03#58598Give `composed_of` a fresh start by dropping the `where()` integration?0 comments · 2026-08-28#58536Can we add something like Laravel Sail or Laravel Herd but for Rails?1 comments · 2026-08-22#58438How to make a guest connection in Action Cable?1 comments · 2026-08-11#57812Source of Truth - Ruby Version1 comments · 2026-06-22
Latest release
8.1.4.1 v8.1.4.1 2026-11-04Active Support
ActiveSupport::MessagePack no longer deserializes an unsafe
ActiveSupport::SafeBuffer as html_safe.
A SafeBuffer that was no longer html_safe?, for example after an
in-place gsub!, was deserialized as an html_safe SafeBuffer. It is now
serialized with an unsafe marker and deserialized as a String. Earlier
versions of Rails cannot read an unsafe buffer serialized this way.
[GHSA-2w9f-fxwj-w2qf]
Jean Boussier
ActiveSupport::Inflectorsafe_constantize matches the constant name in a
LoadError message as a literal string instea