diff options
author | Abdelkader Boudih <terminale@gmail.com> | 2014-09-17 21:03:51 +0100 |
---|---|---|
committer | Abdelkader Boudih <terminale@gmail.com> | 2014-09-17 21:03:51 +0100 |
commit | 402ac43bb5a176706d3ba78f536d08cd8f8518ec (patch) | |
tree | 0455b0fbfff8468ff29df37b4f2cc15f20c3ebb7 /guides | |
parent | 1bf1386a2bcbc195189de5ad1e70c7990430b1ec (diff) | |
parent | a8571131b9515b87b87ae13bc853b2affab18126 (diff) | |
download | rails-402ac43bb5a176706d3ba78f536d08cd8f8518ec.tar.gz rails-402ac43bb5a176706d3ba78f536d08cd8f8518ec.tar.bz2 rails-402ac43bb5a176706d3ba78f536d08cd8f8518ec.zip |
Merge pull request #16930 from todd/upgrade_guide
Added Responders docs, made Web Console docs more consistent. [ci skip]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 2c6797d1fd..4e538693f7 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -55,15 +55,51 @@ a [pull request](https://github.com/rails/rails/edit/master/guides/source/upgrad ### Web Console -First, add `gem 'web-console', '~> 2.0.0.beta3'` to the `:development` group in your Gemfile and run `bundle install` (it won't have been included when you upgraded Rails). Once it's been installed, you can simply drop a reference to the console helper (i.e., `<%= console %>`) into any view you want to enable it for. A console will also be provided on any error page you view in your development environment. +First, add `gem 'web-console', '~> 2.0'` to the `:development` group in your Gemfile and run `bundle install` (it won't have been included when you upgraded Rails). Once it's been installed, you can simply drop a reference to the console helper (i.e., `<%= console %>`) into any view you want to enable it for. A console will also be provided on any error page you view in your development environment. -Additionally, you can tell Rails to automatically mount a VT100-compatible console on a predetermined path by setting `config.web_console.automount = true` in your `config/environments/development.rb`. You can specify the path by setting `config.web_console.default_mount_path` (note that this defaults to `/console`). +Additionally, you can tell Rails to automatically mount a VT100-compatible console on a predetermined path by setting the appropriate configuration flags in your development config: -TODO: Update `web-console` version to release version. +```ruby +# config/environments/development.rb + +config.web_console.automount = true +config.web_console.default_mount_path = '/terminal' # Optional, defaults to /console +``` ### Responders -TODO: mention https://github.com/rails/rails/pull/16526 +`respond_with` and the class-level `respond_to` methods have been extracted to the `responders` gem. To use them, simply add `gem 'responders', '~> 2.0'` to your Gemfile. Calls to `respond_with` and `respond_to` (again, at the class level) will no longer work without having included the `responders` gem in your dependencies: + +```ruby +# app/controllers/users_controller.rb + +class UsersController < ApplicationController + respond_to :html, :json + + def show + @user = User.find(params[:id]) + respond_with @user + end +end +``` + +Instance-level `respond_to` is unaffected and does not require the additional gem: + +```ruby +# app/controllers/users_controller.rb + +class UsersController < ApplicationController + def show + @user = User.find(params[:id]) + respond_to do |format| + format.html + format.json { render json: @user } + end + end +end +``` + +See [#16526](https://github.com/rails/rails/pull/16526) for more details. ### Error handling in transaction callbacks |