Go to file
bogdanvlviv b5b179fb57
Fix "Ruby on Rails 5.2 Release Notes" [ci skip]
- Remove
  ```
  *   Namespace error pages' CSS selectors to stop the styles from bleeding
      into other pages when using Turbolinks.
      ([Pull Request](https://github.com/rails/rails/pull/28814))
  ```
  since it was backported to
  `5-1-stable` by 50d5baf7ed15908ce66c39cc62ce80ad99e313c3
  and
  `5-0-stable` by d1c4a39ed796a31efc51901e7e818609fb3cb7ec.

- Remove
  ```
  *   Allow irb options to be passed from `rails console` command.
      ([Pull Request](https://github.com/rails/rails/pull/29010))
  ```
  since it was backported to
  `5-1-stable` by e91b48348c9a33447bf1bff6e043c043cf36439f.

- Remove
  ```
  *   Load environment file in `dbconsole` command.
      ([Pull Request](https://github.com/rails/rails/pull/29725))
  ```
  since it was backported to
  `5-1-stable` by 7f9342877a80bc9a2a283462babf7b829902dc78.

- Remove
  ```
  *   Gemfile for new apps: upgrade redis-rb from ~> 3.0 to 4.0.
      ([Pull Request](https://github.com/rails/rails/pull/30748))
  ```
  since it was backported to
  `5-1-stable` by 37895311514a35333e5597018852eb0fe2c9eb28.

- Remove
  ```
  *   Fix minitest rails plugin.
      The custom reporters are added only if needed.
      This will fix conflicts with others plugins.
      ([Commit](ac99916fcf))
  ```
  since it was backported to
  `5-1-stable` by caa76956d396a6a9feae7aa17adce784127e92cc.

- Remove
  ```
  *   Add support for compatibility with redis-rb gem for 4.0 version.
      ([Pull Request](https://github.com/rails/rails/pull/30748))
  ```
  since it was backported to
  `5-1-stable` by 37895311514a35333e5597018852eb0fe2c9eb28.

- Remove
  ```
  *   Add `action_controller_api` and `action_controller_base` load hooks to be
      called in `ActiveSupport.on_load`.
      ([Pull Request](https://github.com/rails/rails/pull/28402))
  ```
  since it was backported to
  `5-1-stable` by b9a5fd706a821401cbe3ce11d7a18daa8267588f.

- Remove
  ```
  *   `driven_by` now registers poltergeist and capybara-webkit.
      ([Pull Request](https://github.com/rails/rails/pull/29315))
  ```
  since it was backported to
  `5-1-stable` by c5dd45119a28fb1c41de6d27d63443480c86894e.

- Remove
  ```
  *   Fallback `ActionController::Parameters#to_s` to `Hash#to_s`.
      ([Pull Request](https://github.com/rails/rails/pull/29630))
  ```
  since it was backported to
  `5-1-stable` by c1014e435d26db867b2c15b74c9ef47ccff38edb
  and
  `5-0-stable` by 0e71fc3040edc3c28d12c07300f0162559bbe4e5.

- Remove
  ```
  *   Make `take_failed_screenshot` work within engine.
      ([Pull Request](https://github.com/rails/rails/pull/30421))
  ```
  since it was backported to
  `5-1-stable` by 595a231029ce402445da33eec62775cbe0da97de.

- Remove
  ```
  *   Fix optimized url helpers when using relative url root.
      ([Pull Request](https://github.com/rails/rails/pull/31261))
  ```
  since it was backported to
  `5-1-stable` by e9b77953a277a707ce1fb60e1f9963a833df9312.

- Remove
  ```
  *   Update `distance_of_time_in_words` helper to display better error messages
      for bad input.
      ([Pull Request](https://github.com/rails/rails/pull/20701))
  ```
  since it was backported to
  `5-1-stable` by 2c97fbf6503c9199f3fe5ed06222e7226dc6fcd9.

- Remove
  ```
  *   Generate field ids in `collection_check_boxes` and
      `collection_radio_buttons`.
      ([Pull Request](https://github.com/rails/rails/pull/29412))
  ```
  since it was backported to
  `5-1-stable` by 2d8c10a7b1066d6a577096b4a86e310f1b0d2c22.

- Remove
  ```
  *   Fix issues with scopes and engine on `current_page?` method.
      ([Pull Request](https://github.com/rails/rails/pull/29503))
  ```
  since it was backported to
  `5-1-stable` by 2135daf0d552bbb2eca4208f8c33fb015cf052ab.

- Remove
  ```
  *   Bring back proc with arity of 1 in `ActionMailer::Base.default` proc
      since it was supported in Rails 5.0 but not deprecated.
      ([Pull Request](https://github.com/rails/rails/pull/30391))
  ```
  since it was backported to
  `5-1-stable` by b2bedb149274c8490c782c62dd8ab0bbae6a9730.

- Remove
  ```
  *   Add type caster to `RuntimeReflection#alias_name`.
      ([Pull Request](https://github.com/rails/rails/pull/28961))
  ```
  since it was backported to
  `5-1-stable` by f644e7a6fddf1b239dc1af0b0c6be8af9f776918.

- Remove
  ```
  *   Loading model schema from database is now thread-safe.
      ([Pull Request](https://github.com/rails/rails/pull/29216))
  ```
  since it was backported to
  `5-1-stable` by 02926cfff6a403d28f83903b08ae7375fad8e836.
  and
  `5-0-stable` by 84bcfe5a6a65d3c2998d14b85b9f02560d3f9e98

- Remove
  ```
  *   Fix destroying existing object does not work well when optimistic locking
      enabled and `locking_column` is null in the database.
      ([Pull Request](https://github.com/rails/rails/pull/28926))
  ```
  since it was backported to
  `5-1-stable` by e498052c5210e886f46c61deadd161f8ea41666f.

- Remove
  ```
  *   `ActiveRecord::Persistence#touch` does not work well
      when optimistic locking enabled and `locking_column`,
      without default value, is null in the database.
      ([Pull Request](https://github.com/rails/rails/pull/28914))
  ```
  since it was backported to
  `5-1-stable` by 1e2f63db78b9089fb7011eb954c88136f324e7c0.

- Remove
  ```
  *   Previously, when building records using a `has_many :through` association,
      if the child records were deleted before the parent was saved,
      they would still be persisted. Now, if child records are deleted
      before the parent is saved on a `has_many :through` association,
      the child records will not be persisted.
      ([Pull Request](https://github.com/rails/rails/pull/29593))
  ```
  since it was backported to
  `5-1-stable` by a22c39e9cc08c052bb5c828b45533e5a01c896f1.

- Remove
  ```
  *   Query cache was unavailable when entering the `ActiveRecord::Base.cache`
      block without being connected.
      ([Pull Request](https://github.com/rails/rails/pull/29609))
  ```
  since it was backported to
  `5-1-stable` by fd6c8cdfe69ed3a0763f0ff1dc41d2d2ee2e8752
  and
  `5-0-stable` by 9f2532bb16b49751fbdda51846b156c3eca09054.

- Remove
  ```
  *   `Relation#joins` is no longer affected by the target model's
      `current_scope`, with the exception of `unscoped`.
      ([Commit](5c71000d08))
  ```
  since it was backported to
  `5-1-stable` by 3630d6354cab31bb233a1f1d7b1a4d2c24aef54d.

- Remove
  ```
  *   Fix `unscoped(where: [columns])` removing the wrong bind values.
      ([Pull Request](https://github.com/rails/rails/pull/29780))
  ```
  since it was backported to
  `5-1-stable` by d378fcb254462f9da8d921f0fa2e9b9868a7d34e.

- Remove
  ```
  *   When a `has_one` association is destroyed by `dependent: destroy`,
      `destroyed_by_association` will now be set to the reflection, matching the
      behaviour of `has_many` associations.
      ([Pull Request](https://github.com/rails/rails/pull/29855))
  ```
  since it was backported to
  `5-1-stable` by 8254a8be81c07dbdbc2a281bab72f23f93f6b12f.

- Remove
  ```
  *   Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT`
      to keep the existing select list.
      ([Pull Request](https://github.com/rails/rails/pull/29848))
  ```
  since it was backported to
  `5-1-stable` by 0e8d4edd56f44b27f33bd214aa03af60cc5d39ae.

- Remove
  ```
  *   Ensure `sum` honors `distinct` on `has_many :through` associations.
      ([Commit](566f1fd068))
  ```
  since it was backported to
  `5-1-stable` by c0a1dc256144b91aee5241fad2121e85e6d8093f.

- Remove
  ```
  *   Fix `COUNT(DISTINCT ...)` for `GROUP BY` with `ORDER BY` and `LIMIT`.
      ([Commit](5668dc6b18))
  ```
  since it was backported to
  `5-1-stable` by 87ca68e76eec68ec61fc0d3d3bf315b4bfe45c42.

- Remove
  ```
  *   MySQL: Don't lose `auto_increment: true` in the `db/schema.rb`.
      ([Commit](9493d45535))
  ```
  since it was backported to
  `5-1-stable` by 8b6e694e5febdcb39f72d98ff9d5e7124cc0ca32.

- Remove
  ```
  *   Fix longer sequence name detection for serial columns.
      ([Pull Request](https://github.com/rails/rails/pull/28339))
  ```
  since it was backported to
  `5-1-stable` by af9c1707ad49eb421cf76c1367da3efbf3c39aea
  and
  `5-0-stable` by 7025b1d8ebf694c288c71878b5229394ba3c0580.

- Remove
  ```
  *   Fix `bin/rails db:setup` and `bin/rails db:test:prepare` create wrong
      ar_internal_metadata's data for a test database.
      ([Pull Request](https://github.com/rails/rails/pull/30579))
  ```
  since it was backported to
  `5-1-stable` by bb67b5f278c2dbca65b9dd03038788a4dbb4a21f
  and
  `5-0-stable` by 60437e6d3c99cbbb95a01f31d44be19f7b63e3eb.

- Remove
  ```
  *   Fix conflicts `counter_cache` with `touch: true` by optimistic locking.
      ([Pull Request](https://github.com/rails/rails/pull/31405))
  ```
  since it was backported to
  `5-1-stable` by 5236ddaf35492513895d4a706435520e74ab723b.

- Remove
  ```
  *   Fix `count(:all)` to correctly work `distinct` with custom SELECT list.
      ([Commit](c6cd9a59f2))
  ```
  since it was backported to
  `5-1-stable` by 6beb4de7dd5205d9b08ce4eedbe383cb0b18540d.

- Remove
  ```
  *   Fix to invoke callbacks when using `update_attribute`.
      ([Commit](732aa34b6e))
  ```
  since it was backported to
  `5-1-stable` by 6346683bc58b79b2745e9305e65a6f1f1a63c288.

- Remove
  ```
  *   Use `count(:all)` in `HasManyAssociation#count_records` to prevent invalid
      SQL queries for association counting.
      ([Pull Request](https://github.com/rails/rails/pull/27561))
  ```
  since it was backported to
  `5-1-stable` by eef3c89e3b38c99c79decb1ec5d6854f4ab9ea18.

- Remove
  ```
  *   Fix `count(:all)` with eager loading and having an order other than
      the driving table.
      ([Commit](ebc09ed9ad))
  ```
  since it was backported to
  `5-1-stable` by 6df9b69b2363734175d8869393e83e6ce8b4d7b6.

- Remove
  ```
  *   PostgreSQL: Allow pg-1.0 gem to be used with Active Record.
      ([Pull Request](https://github.com/rails/rails/pull/31671))
  ```
  since it was backported to
  `5-1-stable` by a9c06f61d52c7cf03dc413dd50e9a9c5ab580703.

- Remove
  ```
  *   Fix that after commit callbacks on update does not triggered
      when optimistic locking is enabled.
      ([Commit](7f9bd034c4))
  ```
  since it was backported to
  `5-1-stable` by aaee10e6e4fdfbc8bb7dc6169ed9deea3638c5a8.

- Remove
  ```
  *   Fix regression in numericality validator when comparing Decimal and Float
      input values with more scale than the schema.
      ([Pull Request](https://github.com/rails/rails/pull/28584))
  ```
  since it was backported to
  `5-1-stable` by 5b1c3e5a8b02d0078bd2527ca0969b0d89fec433.
  Note that there was incorrect link to PR,
  original PR is https://github.com/rails/rails/pull/29249.

- Remove
  ```
  *   Fix to working before/after validation callbacks on multiple contexts.
      ([Pull Request](https://github.com/rails/rails/pull/31483))
  ```
  since it was backported to
  `5-1-stable` by 0f7046a7f820186fd6fbe19a6142002cb8537fe6.

- Remove
  ```
  *   Fix implicit coercion calculations with scalars and durations.
      ([Pull Request](https://github.com/rails/rails/pull/29163),
      [Pull Request](https://github.com/rails/rails/pull/29971))
  ```
  since it was backported to
  `5-1-stable` by 51ea27c04c60373d97e212389d587821deae6fe0,
                  4d82e2aad98ddf7c1a54e588288dcf1f68ad7af4.

- Remove
  ```
  *   Fix modulo operations involving durations.
      ([Commit](a54e13bd2e))
  ```
  since it was backported to
  `5-1-stable` by 233fa7eab36e7d6fb515b2e55c699bff9858ea5f.

- Remove
  ```
  *   Return all mappings for a timezone identifier in `country_zones`.
      ([Commit](cdce6a709e))
  ```
  since it was backported to
  `5-1-stable` by 0222ebbe0695fd1fbaf98e64333d9d7b285a54ed.

- Remove
  ```
  *   Add support for compatibility with redis-rb gem for 4.0 version.
      ([Pull Request](https://github.com/rails/rails/pull/30748))
  ```
  since it was backported to
  `5-1-stable` by 37895311514a35333e5597018852eb0fe2c9eb28.
  Related to #32252.

Related to #32222, https://github.com/rails/rails/pull/32222#discussion_r174256536.
Follow up a489cc81b6aa1187b169ddccc92f4c077fe0408f.
2018-03-18 15:33:26 +02:00
.github Limit stale checks to issues 2017-04-01 11:27:26 -05:00
actioncable Remove changelog header for unreleased version 2018-03-13 15:20:57 -04:00
actionmailer Merge pull request #32231 from gmcgibbon/perform_email_jobs_in_assert_emails 2018-03-13 15:18:49 -04:00
actionpack Fix routing inspector tests broken in 6629d51a27 2018-03-13 21:30:21 +01:00
actionview Pass the skip_pipeline option in image_submit_tag 2018-03-14 11:18:06 +00:00
activejob Remove changelog header for unreleased version 2018-03-13 15:20:57 -04:00
activemodel Merge pull request #32220 from rails/fix-time-columns-on-sqlite3 2018-03-15 11:59:47 +00:00
activerecord Merge pull request #32220 from rails/fix-time-columns-on-sqlite3 2018-03-15 11:59:47 +00:00
activestorage Remove changelog header for unreleased version 2018-03-13 15:20:57 -04:00
activesupport Don't marshal ActiveSupport::Cache::Entry objects twice 2018-03-14 13:42:40 -06:00
ci Only run isolated tests on the latest stable ruby: that's now 2.5 2018-01-25 09:55:10 +10:30
guides Fix "Ruby on Rails 5.2 Release Notes" [ci skip] 2018-03-18 15:33:26 +02:00
railties Pass the skip_pipeline option in image_submit_tag 2018-03-14 11:18:06 +00:00
tasks Deprecate safe_level of ERB.new in Ruby 2.6 2018-03-05 18:49:45 +09:00
tools Use frozen string literal in tools/ 2017-08-13 22:04:59 +09:00
.codeclimate.yml Use rubocop-0-52 channel 2018-02-23 00:30:10 +00:00
.gitattributes adds .gitattributes to enable Ruby-awareness 2016-03-16 11:15:22 +01:00
.gitignore Clean up and consolidate .gitignores 2018-02-17 14:26:19 -08:00
.rubocop.yml Add cop for preferring 'Foo.method' over 'Foo::method' 2018-02-22 06:26:48 +00:00
.travis.yml Restore full Travis config 2018-03-12 23:18:17 -04:00
.yardopts Let YARD document the railties gem 2010-09-09 18:24:34 -07:00
CODE_OF_CONDUCT.md Move the CoC text to the Rails website 2015-08-21 12:32:59 -07:00
CONTRIBUTING.md Remove html tag making markdown misrender [ci skip] 2017-06-05 22:11:57 -05:00
Gemfile Avoid dalli 2.7.7 for now 2018-03-15 21:03:06 +09:00
Gemfile.lock Avoid dalli 2.7.7 for now 2018-03-15 21:03:06 +09:00
MIT-LICENSE Bump license years for 2018 2017-12-31 22:36:55 +09:00
RAILS_VERSION Start Rails 6.0 development!!! 2018-01-30 18:51:17 -05:00
rails.gemspec Rails 6 requires Ruby 2.4.1+ 2018-02-17 15:34:57 -08:00
Rakefile Use frozen string literal in root files 2017-08-13 22:14:24 +09:00
README.md Update MIT licenses link [ci skip] 2017-08-22 08:46:02 +09:00
RELEASING_RAILS.md Fix grammar issue [ci skip] 2017-10-31 13:53:37 -04:00
version.rb Start Rails 6.0 development!!! 2018-01-30 18:51:17 -05:00

Welcome to 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, 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.

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 (README), a library to generate and send emails; Active Job (README), a framework for declaring jobs and making them run on a variety of queueing backends; Action Cable (README), a framework to integrate WebSockets with a Rails application; Active Storage (README), a library to attach cloud and local files to Rails applications; 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.

Getting Started

  1. Install Rails at the command prompt if you haven't yet:

     $ gem install rails
    
  2. At the command prompt, create a new Rails application:

     $ rails new myapp
    

    where "myapp" is the application name.

  3. Change directory to myapp and start the web server:

     $ cd myapp
     $ rails server
    

    Run with --help or -h for options.

  4. Using a browser, go to http://localhost:3000 and you'll see: "Yay! Youre on Rails!"

  5. Follow the guidelines to start developing your application. You may find the following resources handy:

Contributing

Code Triage Badge

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!

Trying to report a possible security vulnerability in Rails? Please check out our security policy for guidelines about how to proceed.

Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails code of conduct.

Code Status

Build Status

License

Ruby on Rails is released under the MIT License.