-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
148 lines (87 loc) · 6.61 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
title: RDOC_MAIN.md
layout: default
---
<div>
<div class="banner">
<span>Ruby on Rails 7.2.2</span><br />
<h1>
RDOC_MAIN.md
</h1>
<ul class="files">
<li>
railties/RDOC_MAIN.md
<a href="https://github.com/rails/rails/blob/d0dcb8fa6073a0c4d42600c15e82e3bb386b27d3/railties/RDOC_MAIN.md" target="_blank" class="github_url">on GitHub</a>
</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<h1 id="label-Welcome+to+Rails">Welcome to Rails</h1>
<h2 id="label-What-27s+Rails-3F">What’s Rails?</h2>
<p>Rails is a web-application framework that includes everything needed to create database-backed web applications according to the <a href="https://en.wikipedia.org/wiki/Model-view-controller">Model-View-Controller (MVC)</a> pattern.</p>
<p>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.</p>
<h2 id="label-Model+layer">Model layer</h2>
<p>The <strong><em>Model layer</em></strong> 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 <code>ActiveRecord::Base</code>. <a href="files/activerecord/README_rdoc.html">Active Record</a> 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 <a href="files/activemodel/README_rdoc.html">Active Model</a> module.</p>
<h2 id="label-View+layer">View layer</h2>
<p>The <strong><em>View layer</em></strong> 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 <a href="files/actionview/README_rdoc.html">Action View</a>.</p>
<h2 id="label-Controller+layer">Controller layer</h2>
<p>The <strong><em>Controller layer</em></strong> 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 <code>ActionController::Base</code>. Action Dispatch and Action Controller are bundled together in <a href="files/actionpack/README_rdoc.html">Action Pack</a>.</p>
<h2 id="label-Frameworks+and+libraries">Frameworks and libraries</h2>
<p><a href="files/activerecord/README_rdoc.html">Active Record</a>, <a href="files/activemodel/README_rdoc.html">Active Model</a>, <a href="files/actionpack/README_rdoc.html">Action Pack</a>, and <a href="files/actionview/README_rdoc.html">Action View</a> can each be used independently outside Rails.</p>
<p>In addition to that, Rails also comes with:</p>
<ul><li>
<p><a href="files/actionmailer/README_rdoc.html">Action Mailer</a>, a library to generate and send emails</p>
</li><li>
<p><a href="files/actionmailbox/README_md.html">Action Mailbox</a>, a library to receive emails within a Rails application</p>
</li><li>
<p><a href="files/activejob/README_md.html">Active Job</a>, a framework for declaring jobs and making them run on a variety of queuing backends</p>
</li><li>
<p><a href="files/actioncable/README_md.html">Action Cable</a>, a framework to integrate WebSockets with a Rails application</p>
</li><li>
<p><a href="files/activestorage/README_md.html">Active Storage</a>, a library to attach cloud and local files to Rails applications</p>
</li><li>
<p><a href="files/actiontext/README_md.html">Action Text</a>, a library to handle rich text content</p>
</li><li>
<p><a href="files/activesupport/README_rdoc.html">Active Support</a>, a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails</p>
</li></ul>
<h2 id="label-Getting+Started">Getting Started</h2>
<ol><li>
<p>Install Rails at the command prompt if you haven't yet:</p>
<pre><code>$ gem install rails
</code></pre>
</li><li>
<p>At the command prompt, create a new Rails application:</p>
<pre><code>$ rails new myapp
</code></pre>
<p>where "myapp" is the application name.</p>
</li><li>
<p>Change directory to <code>myapp</code> and start the web server:</p>
<pre><code>$ cd myapp
$ bin/rails server
</code></pre>
<p>Run with <code>--help</code> or <code>-h</code> for options.</p>
</li><li>
<p>Go to <code>http://localhost:3000</code> and you'll see the Rails bootscreen with your Rails and Ruby versions.</p>
</li><li>
<p>Follow the guidelines to start developing your application. You may find the following resources handy:</p>
<ul><li>
<p><a href="https://guides.rubyonrails.org/getting_started.html">Getting Started with Rails</a></p>
</li><li>
<p><a href="https://guides.rubyonrails.org">Ruby on Rails Guides</a></p>
</li><li>
<p><a href="https://api.rubyonrails.org">The API Documentation</a></p>
</li></ul>
</li></ol>
<h2 id="label-Contributing">Contributing</h2>
<p>We encourage you to contribute to Ruby on Rails! Please check out the <a href="https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails guide</a> for guidelines about how to proceed. <a href="https://contributors.rubyonrails.org">Join us!</a></p>
<p>Trying to report a possible security vulnerability in Rails? Please check out our <a href="https://rubyonrails.org/security">security policy</a> for guidelines about how to proceed.</p>
<p>Everyone interacting in Rails and its sub-projects’ codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails <a href="https://rubyonrails.org/conduct">code of conduct</a>.</p>
<h2 id="label-License">License</h2>
<p>Ruby on Rails is released under the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
</div>
<!-- Methods -->
</div>
</div>
</div>