rails /rails

Ruby on Rails

★ 59,089⑂ 23,114👁 2,355⑃ 40,406● 18,750▤ 172◈ 122
RubyMITCreated 2008-04-11rubyonrails.org
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

Discussions

Latest release

8.1.4.1 v8.1.4.1 2026-11-04
Active 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

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON