diff options
author | Bonghyun Kim <bonghyun.kim@headflow.net> | 2016-07-26 03:24:01 +0900 |
---|---|---|
committer | Bonghyun Kim <bonghyun.d.kim@gmail.com> | 2016-07-28 02:30:49 +0900 |
commit | 8243434d9cba57d44bf00548f0033bcf38c1c723 (patch) | |
tree | 4db7ef2eb6fe28386fd26267bebad94676fac82c /guides/source | |
parent | 7e6996a1b36cdf8158a27eeaa7e6d97a05994707 (diff) | |
download | rails-8243434d9cba57d44bf00548f0033bcf38c1c723.tar.gz rails-8243434d9cba57d44bf00548f0033bcf38c1c723.tar.bz2 rails-8243434d9cba57d44bf00548f0033bcf38c1c723.zip |
Updated getting_started guide to reflect the change in error message for ActionController::UnknownFromat in ArticlesController#new
Restored texts about XML and JS template handlers. [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/getting_started.md | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 0f1c3735e8..73dbb2bc40 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -465,29 +465,24 @@ The first part identifies which template is missing. In this case, it's the then it will attempt to load a template called `application/new`. It looks for one here because the `ArticlesController` inherits from `ApplicationController`. -The next part of the message contains a hash. The `:locale` key in this hash -simply indicates which spoken language template should be retrieved. By default, -this is the English - or "en" - template. The next key, `:formats` specifies the -format of the template to be served in response. The default format is `:html`, and -so Rails is looking for an HTML template. The final key, `:handlers`, is telling -us what _template handlers_ could be used to render our template. `:erb` is most -commonly used for HTML templates, `:builder` is used for XML templates, and -`:coffee` uses CoffeeScript to build JavaScript templates. - -The message also contains `request.formats` which specifies the format of template to be -served in response. It is set to `text/html` as we requested this page via browser, so Rails -is looking for an HTML template. +The next part of the message contains `request.formats` which specifies +the format of template to be served in response. It is set to `text/html` as we +requested this page via browser, so Rails is looking for an HTML template. +`request.variants` specifies what kind of physical devices would be served by +the response and helps Rails determine which template to use in the response. +It is empty because no information has been provided. The simplest template that would work in this case would be one located at `app/views/articles/new.html.erb`. The extension of this file name is important: the first extension is the _format_ of the template, and the second extension -is the _handler_ that will be used. Rails is attempting to find a template -called `articles/new` within `app/views` for the application. The format for -this template can only be `html` and the handler must be one of `erb`, -`builder` or `coffee`. `:erb` is most commonly used for HTML templates, `:builder` is -used for XML templates, and `:coffee` uses CoffeeScript to build JavaScript templates. -Because you want to create a new HTML form, you will be -using the `ERB` language which is designed to embed Ruby in HTML. +is the _handler_ that will be used to render the template. Rails is attempting +to find a template called `articles/new` within `app/views` for the +application. The format for this template can only be `html` and the default +handler for HTML is `erb`. Rails uses other handlers for other formats. +`builder` handler is used to build XML templates and `coffee` handler uses +CoffeeScript to build JavaScript templates. Because you want to create a new +HTML form, you will be using the `ERB` language which is designed to embed Ruby +in HTML. Therefore the file should be called `articles/new.html.erb` and needs to be located inside the `app/views` directory of the application. |