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. 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 Record
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.
Active Record, Action Pack, and Action View can each be used independently outside Rails. In addition to them, Rails also comes with Action Mailer (README), a library to generate and send emails; and Active Support (README), a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails.
Install Rails at the command prompt if you haven't yet:
gem install rails
At the command prompt, create a new Rails application:
rails new myapp
where "myapp" is the application name.
Change directory to myapp
and start the web server:
cd myapp
rails server
Run with --help
or -h
for options.
Using a browser, go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"
Follow the guidelines to start developing your application. You may find the following resources handy:
We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!
Ruby on Rails is released under the MIT License.
<h2>Welcome to Rails</h2>
<p>Rails is a web-application framework that includes everything needed to
create database-backed web applications according to the
<a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller (MVC)</a>
pattern.</p>
<p>Understanding the MVC pattern is key to understanding Rails. MVC divides your
application into three layers, each with a specific responsibility.</p>
<p>The <em>Model layer</em> 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
<code>ActiveRecord::Base</code>. 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. You can read more about Active Record
in its <a href="activerecord/README.rdoc">README</a>.</p>
<p>The <em>Controller layer</em> 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 Action Pack. You can read more about Action Pack in its
<a href="actionpack/README.rdoc">README</a>.</p>
<p>The <em>View layer</em> 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 <a href="actionview/README.rdoc">README</a>.</p>
<p>Active Record, Action Pack, and Action View can each be used independently outside Rails.
In addition to them, Rails also comes with Action Mailer (<a href="actionmailer/README.rdoc">README</a>), a library
to generate and send emails; and Active Support (<a href="activesupport/README.rdoc">README</a>), a collection of
utility classes and standard library extensions that are useful for Rails, and may also be used
independently outside Rails.</p>
<h2>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
rails server
</code></pre>
<p>Run with <code>--help</code> or <code>-h</code> for options.</p></li>
<li><p>Using a browser, go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"</p></li>
<li><p>Follow the guidelines to start developing your application. You may find
the following resources handy:</p>
<ul>
<li><a href="http://guides.rubyonrails.org/getting_started.html">Getting Started with Rails</a></li>
<li><a href="http://guides.rubyonrails.org">Ruby on Rails Guides</a></li>
<li><a href="http://api.rubyonrails.org">The API Documentation</a></li>
<li><a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">Ruby on Rails Tutorial</a></li>
</ul></li>
</ol>
<h2>Contributing</h2>
<p>We encourage you to contribute to Ruby on Rails! Please check out the
<a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails guide</a> for guidelines about how to proceed. <a href="http://contributors.rubyonrails.org">Join us!</a></p>
<h2>Code Status</h2>
<ul>
<li><a href="https://travis-ci.org/rails/rails"><img src="https://api.travis-ci.org/rails/rails.png" alt="Build Status" /></a></li>
<li><a href="https://gemnasium.com/rails/rails"><img src="https://gemnasium.com/rails/rails.png?travis" alt="Dependencies" /></a></li>
</ul>
<h2>License</h2>
<p>Ruby on Rails is released under the <a href="http://www.opensource.org/licenses/MIT">MIT License</a>.</p>
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. 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 Record
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.
Active Record, Action Pack, and Action View can each be used independently outside Rails. In addition to them, Rails also comes with Action Mailer (README), a library to generate and send emails; and Active Support (README), a collection of utility classes and standard library extensions that are useful for Rails, and may also be used independently outside Rails.
Install Rails at the command prompt if you haven't yet:
gem install rails
At the command prompt, create a new Rails application:
rails new myapp
where "myapp" is the application name.
Change directory to myapp
and start the web server:
cd myapp
rails server
Run with --help
or -h
for options.
Using a browser, go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"
Follow the guidelines to start developing your application. You may find the following resources handy:
We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!
Ruby on Rails is released under the MIT License.
<h2>Welcome to Rails</h2>
<p>Rails is a web-application framework that includes everything needed to
create database-backed web applications according to the
<a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model-View-Controller (MVC)</a>
pattern.</p>
<p>Understanding the MVC pattern is key to understanding Rails. MVC divides your
application into three layers, each with a specific responsibility.</p>
<p>The <em>Model layer</em> 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
<code>ActiveRecord::Base</code>. 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. You can read more about Active Record
in its <a href="activerecord/README.rdoc">README</a>.</p>
<p>The <em>Controller layer</em> 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 Action Pack. You can read more about Action Pack in its
<a href="actionpack/README.rdoc">README</a>.</p>
<p>The <em>View layer</em> 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 <a href="actionview/README.rdoc">README</a>.</p>
<p>Active Record, Action Pack, and Action View can each be used independently outside Rails.
In addition to them, Rails also comes with Action Mailer (<a href="actionmailer/README.rdoc">README</a>), a library
to generate and send emails; and Active Support (<a href="activesupport/README.rdoc">README</a>), a collection of
utility classes and standard library extensions that are useful for Rails, and may also be used
independently outside Rails.</p>
<h2>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
rails server</code></pre>
<p>Run with <code>--help</code> or <code>-h</code> for options.</p>
</li>
<li>
<p>Using a browser, go to <a href="http://localhost:3000">http://localhost:3000</a> and you'll see: "Welcome aboard: You're riding Ruby on Rails!"</p>
</li>
<li>
<p>Follow the guidelines to start developing your application. You may find
the following resources handy:</p>
<ul>
<li><a href="http://guides.rubyonrails.org/getting_started.html">Getting Started with Rails</a></li>
<li><a href="http://guides.rubyonrails.org">Ruby on Rails Guides</a></li>
<li><a href="http://api.rubyonrails.org">The API Documentation</a></li>
<li><a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book">Ruby on Rails Tutorial</a></li>
</ul>
</li>
</ol>
<h2>Contributing</h2>
<p>We encourage you to contribute to Ruby on Rails! Please check out the
<a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails guide</a> for guidelines about how to proceed. <a href="http://contributors.rubyonrails.org">Join us!</a></p>
<h2>Code Status</h2>
<ul>
<li><a href="https://travis-ci.org/rails/rails"><img src="https://api.travis-ci.org/rails/rails.png" alt="Build Status" /></a></li>
<li><a href="https://gemnasium.com/rails/rails"><img src="https://gemnasium.com/rails/rails.png?travis" alt="Dependencies" /></a></li>
</ul>
<h2>License</h2>
<p>Ruby on Rails is released under the <a href="http://www.opensource.org/licenses/MIT">MIT License</a>.</p>