rails 4.1.4 → 4.2.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +12 -10
  3. data/guides/CHANGELOG.md +87 -15
  4. data/guides/Rakefile +21 -6
  5. data/guides/assets/images/getting_started/article_with_comments.png +0 -0
  6. data/guides/assets/javascripts/guides.js +6 -0
  7. data/guides/assets/stylesheets/main.css +4 -1
  8. data/guides/bug_report_templates/action_controller_gem.rb +3 -3
  9. data/guides/bug_report_templates/action_controller_master.rb +3 -2
  10. data/guides/bug_report_templates/active_record_gem.rb +1 -1
  11. data/guides/bug_report_templates/generic_gem.rb +15 -0
  12. data/guides/bug_report_templates/generic_master.rb +26 -0
  13. data/guides/rails_guides/helpers.rb +1 -1
  14. data/guides/rails_guides/levenshtein.rb +27 -21
  15. data/guides/rails_guides/markdown/renderer.rb +1 -1
  16. data/guides/rails_guides/markdown.rb +11 -7
  17. data/guides/rails_guides.rb +2 -2
  18. data/guides/source/2_2_release_notes.md +1 -1
  19. data/guides/source/2_3_release_notes.md +4 -4
  20. data/guides/source/3_0_release_notes.md +8 -8
  21. data/guides/source/3_1_release_notes.md +6 -3
  22. data/guides/source/3_2_release_notes.md +6 -3
  23. data/guides/source/4_0_release_notes.md +6 -3
  24. data/guides/source/4_1_release_notes.md +10 -11
  25. data/guides/source/4_2_release_notes.md +877 -0
  26. data/guides/source/_license.html.erb +1 -1
  27. data/guides/source/_welcome.html.erb +6 -8
  28. data/guides/source/action_controller_overview.md +28 -11
  29. data/guides/source/action_mailer_basics.md +97 -29
  30. data/guides/source/action_view_overview.md +142 -191
  31. data/guides/source/active_job_basics.md +339 -0
  32. data/guides/source/active_model_basics.md +371 -17
  33. data/guides/source/active_record_basics.md +25 -24
  34. data/guides/source/active_record_callbacks.md +12 -9
  35. data/guides/source/{migrations.md → active_record_migrations.md} +135 -226
  36. data/guides/source/active_record_postgresql.md +433 -0
  37. data/guides/source/active_record_querying.md +270 -262
  38. data/guides/source/active_record_validations.md +24 -14
  39. data/guides/source/active_support_core_extensions.md +115 -123
  40. data/guides/source/active_support_instrumentation.md +10 -18
  41. data/guides/source/api_documentation_guidelines.md +63 -17
  42. data/guides/source/asset_pipeline.md +266 -125
  43. data/guides/source/association_basics.md +96 -80
  44. data/guides/source/autoloading_and_reloading_constants.md +1311 -0
  45. data/guides/source/caching_with_rails.md +32 -7
  46. data/guides/source/command_line.md +52 -30
  47. data/guides/source/configuring.md +161 -33
  48. data/guides/source/contributing_to_ruby_on_rails.md +198 -114
  49. data/guides/source/credits.html.erb +2 -2
  50. data/guides/source/debugging_rails_applications.md +448 -294
  51. data/guides/source/development_dependencies_install.md +47 -36
  52. data/guides/source/documents.yaml +19 -7
  53. data/guides/source/engines.md +217 -196
  54. data/guides/source/form_helpers.md +79 -56
  55. data/guides/source/generators.md +24 -11
  56. data/guides/source/getting_started.md +361 -222
  57. data/guides/source/i18n.md +113 -69
  58. data/guides/source/index.html.erb +1 -0
  59. data/guides/source/initialization.md +110 -63
  60. data/guides/source/layout.html.erb +5 -11
  61. data/guides/source/layouts_and_rendering.md +26 -26
  62. data/guides/source/maintenance_policy.md +26 -4
  63. data/guides/source/nested_model_forms.md +7 -4
  64. data/guides/source/plugins.md +27 -27
  65. data/guides/source/rails_application_templates.md +21 -3
  66. data/guides/source/rails_on_rack.md +12 -10
  67. data/guides/source/routing.md +115 -75
  68. data/guides/source/ruby_on_rails_guides_guidelines.md +11 -12
  69. data/guides/source/security.md +41 -35
  70. data/guides/source/testing.md +199 -119
  71. data/guides/source/upgrading_ruby_on_rails.md +319 -32
  72. data/guides/source/working_with_javascript_in_rails.md +19 -17
  73. data/guides/w3c_validator.rb +2 -0
  74. metadata +42 -95
  75. data/guides/code/getting_started/Gemfile +0 -40
  76. data/guides/code/getting_started/Gemfile.lock +0 -125
  77. data/guides/code/getting_started/README.rdoc +0 -28
  78. data/guides/code/getting_started/Rakefile +0 -6
  79. data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
  80. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
  81. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
  82. data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
  83. data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
  84. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
  85. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
  86. data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
  87. data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
  88. data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
  89. data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
  90. data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
  91. data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
  92. data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
  93. data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
  94. data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
  95. data/guides/code/getting_started/app/models/comment.rb +0 -3
  96. data/guides/code/getting_started/app/models/post.rb +0 -7
  97. data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
  98. data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
  99. data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
  100. data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
  101. data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
  102. data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
  103. data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
  104. data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
  105. data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
  106. data/guides/code/getting_started/bin/bundle +0 -4
  107. data/guides/code/getting_started/bin/rails +0 -4
  108. data/guides/code/getting_started/bin/rake +0 -4
  109. data/guides/code/getting_started/config/application.rb +0 -18
  110. data/guides/code/getting_started/config/boot.rb +0 -4
  111. data/guides/code/getting_started/config/database.yml +0 -25
  112. data/guides/code/getting_started/config/environment.rb +0 -5
  113. data/guides/code/getting_started/config/environments/development.rb +0 -30
  114. data/guides/code/getting_started/config/environments/production.rb +0 -80
  115. data/guides/code/getting_started/config/environments/test.rb +0 -36
  116. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
  117. data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
  118. data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
  119. data/guides/code/getting_started/config/initializers/locale.rb +0 -9
  120. data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
  121. data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
  122. data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
  123. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
  124. data/guides/code/getting_started/config/locales/en.yml +0 -23
  125. data/guides/code/getting_started/config/routes.rb +0 -7
  126. data/guides/code/getting_started/config.ru +0 -4
  127. data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
  128. data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
  129. data/guides/code/getting_started/db/schema.rb +0 -33
  130. data/guides/code/getting_started/db/seeds.rb +0 -7
  131. data/guides/code/getting_started/public/404.html +0 -60
  132. data/guides/code/getting_started/public/422.html +0 -60
  133. data/guides/code/getting_started/public/500.html +0 -59
  134. data/guides/code/getting_started/public/favicon.ico +0 -0
  135. data/guides/code/getting_started/public/robots.txt +0 -5
  136. data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
  137. data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
  138. data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
  139. data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
  140. data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
  141. data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
  142. data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
  143. data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
  144. data/guides/code/getting_started/test/models/comment_test.rb +0 -7
  145. data/guides/code/getting_started/test/models/post_test.rb +0 -7
  146. data/guides/code/getting_started/test/test_helper.rb +0 -12
@@ -7,7 +7,6 @@ After reading this guide, you will know:
7
7
  * How best to use templates, partials, and layouts.
8
8
  * What helpers are provided by Action View and how to make your own.
9
9
  * How to use localized views.
10
- * How to use Action View outside of Rails.
11
10
 
12
11
  --------------------------------------------------------------------------------
13
12
 
@@ -28,34 +27,34 @@ For each controller there is an associated directory in the `app/views` director
28
27
  Let's take a look at what Rails does by default when creating a new resource using the scaffold generator:
29
28
 
30
29
  ```bash
31
- $ bin/rails generate scaffold post
30
+ $ bin/rails generate scaffold article
32
31
  [...]
33
32
  invoke scaffold_controller
34
- create app/controllers/posts_controller.rb
33
+ create app/controllers/articles_controller.rb
35
34
  invoke erb
36
- create app/views/posts
37
- create app/views/posts/index.html.erb
38
- create app/views/posts/edit.html.erb
39
- create app/views/posts/show.html.erb
40
- create app/views/posts/new.html.erb
41
- create app/views/posts/_form.html.erb
35
+ create app/views/articles
36
+ create app/views/articles/index.html.erb
37
+ create app/views/articles/edit.html.erb
38
+ create app/views/articles/show.html.erb
39
+ create app/views/articles/new.html.erb
40
+ create app/views/articles/_form.html.erb
42
41
  [...]
43
42
  ```
44
43
 
45
44
  There is a naming convention for views in Rails. Typically, the views share their name with the associated controller action, as you can see above.
46
- For example, the index controller action of the `posts_controller.rb` will use the `index.html.erb` view file in the `app/views/posts` directory.
47
- The complete HTML returned to the client is composed of a combination of this ERB file, a layout template that wraps it, and all the partials that the view may reference. Later on this guide you can find a more detailed documentation of each one of these three components.
45
+ For example, the index controller action of the `articles_controller.rb` will use the `index.html.erb` view file in the `app/views/articles` directory.
46
+ The complete HTML returned to the client is composed of a combination of this ERB file, a layout template that wraps it, and all the partials that the view may reference. Within this guide you will find more detailed documentation about each of these three components.
48
47
 
49
48
 
50
49
  Templates, Partials and Layouts
51
50
  -------------------------------
52
51
 
53
- As mentioned before, the final HTML output is a composition of three Rails elements: `Templates`, `Partials` and `Layouts`.
54
- Below is a brief overview of each one of them.
52
+ As mentioned, the final HTML output is a composition of three Rails elements: `Templates`, `Partials` and `Layouts`.
53
+ Below is a brief overview of each of them.
55
54
 
56
55
  ### Templates
57
56
 
58
- Action View templates can be written in several ways. If the template file has a `.erb` extension then it uses a mixture of ERB (included in Ruby) and HTML. If the template file has a `.builder` extension then a fresh instance of `Builder::XmlMarkup` library is used.
57
+ Action View templates can be written in several ways. If the template file has a `.erb` extension then it uses a mixture of ERB (Embedded Ruby) and HTML. If the template file has a `.builder` extension then the `Builder::XmlMarkup` library is used.
59
58
 
60
59
  Rails supports multiple template systems and uses a file extension to distinguish amongst them. For example, an HTML file using the ERB template system will have `.html.erb` as a file extension.
61
60
 
@@ -72,7 +71,7 @@ Consider the following loop for names:
72
71
  <% end %>
73
72
  ```
74
73
 
75
- The loop is set up in regular embedding tags (`<% %>`) and the name is written using the output embedding tags (`<%= %>`). Note that this is not just a usage suggestion, for regular output functions like `print` or `puts` won't work with ERB templates. So this would be wrong:
74
+ The loop is set up using regular embedding tags (`<% %>`) and the name is inserted using the output embedding tags (`<%= %>`). Note that this is not just a usage suggestion: regular output functions such as `print` and `puts` won't be rendered to the view with ERB templates. So this would be wrong:
76
75
 
77
76
  ```html+erb
78
77
  <%# WRONG %>
@@ -231,7 +230,7 @@ The `object` and `as` options can also be used together:
231
230
 
232
231
  #### Rendering Collections
233
232
 
234
- It is very common that a template needs to iterate over a collection and render a sub-template for each of the elements. This pattern has been implemented as a single method that accepts an array and renders a partial for each one of the elements in the array.
233
+ It is very common that a template will need to iterate over a collection and render a sub-template for each of the elements. This pattern has been implemented as a single method that accepts an array and renders a partial for each one of the elements in the array.
235
234
 
236
235
  So this example for rendering all the products:
237
236
 
@@ -247,7 +246,7 @@ can be rewritten in a single line:
247
246
  <%= render partial: "product", collection: @products %>
248
247
  ```
249
248
 
250
- When a partial is called like this (eg. with a collection), the individual instances of the partial have access to the member of the collection being rendered via a variable named after the partial. In this case, the partial is `_product`, and within it you can refer to `product` to get the instance that is being rendered.
249
+ When a partial is called with a collection, the individual instances of the partial have access to the member of the collection being rendered via a variable named after the partial. In this case, the partial is `_product`, and within it you can refer to `product` to get the collection member that is being rendered.
251
250
 
252
251
  You can use a shorthand syntax for rendering collections. Assuming `@products` is a collection of `Product` instances, you can simply write the following to produce the same result:
253
252
 
@@ -255,7 +254,7 @@ You can use a shorthand syntax for rendering collections. Assuming `@products` i
255
254
  <%= render @products %>
256
255
  ```
257
256
 
258
- Rails determines the name of the partial to use by looking at the model name in the collection, `Product` in this case. In fact, you can even create a heterogeneous collection and render it this way, and Rails will choose the proper partial for each member of the collection.
257
+ Rails determines the name of the partial to use by looking at the model name in the collection, `Product` in this case. In fact, you can even render a collection made up of instances of different models using this shorthand, and Rails will choose the proper partial for each member of the collection.
259
258
 
260
259
  #### Spacer Templates
261
260
 
@@ -269,30 +268,30 @@ Rails will render the `_product_ruler` partial (with no data passed to it) betwe
269
268
 
270
269
  ### Layouts
271
270
 
272
- Layouts can be used to render a common view template around the results of Rails controller actions. Typically, every Rails application has a couple of overall layouts that most pages are rendered within. For example, a site might have a layout for a logged in user, and a layout for the marketing or sales side of the site. The logged in user layout might include top-level navigation that should be present across many controller actions. The sales layout for a SaaS app might include top-level navigation for things like "Pricing" and "Contact Us." You would expect each layout to have a different look and feel. You can read more details about Layouts in the [Layouts and Rendering in Rails](layouts_and_rendering.html) guide.
271
+ Layouts can be used to render a common view template around the results of Rails controller actions. Typically, a Rails application will have a couple of layouts that pages will be rendered within. For example, a site might have one layout for a logged in user and another for the marketing or sales side of the site. The logged in user layout might include top-level navigation that should be present across many controller actions. The sales layout for a SaaS app might include top-level navigation for things like "Pricing" and "Contact Us" pages. You would expect each layout to have a different look and feel. You can read about layouts in more detail in the [Layouts and Rendering in Rails](layouts_and_rendering.html) guide.
273
272
 
274
273
  Partial Layouts
275
274
  ---------------
276
275
 
277
- Partials can have their own layouts applied to them. These layouts are different than the ones that are specified globally for the entire action, but they work in a similar fashion.
276
+ Partials can have their own layouts applied to them. These layouts are different from those applied to a controller action, but they work in a similar fashion.
278
277
 
279
- Let's say we're displaying a post on a page, that should be wrapped in a `div` for display purposes. First, we'll create a new `Post`:
278
+ Let's say we're displaying an article on a page which should be wrapped in a `div` for display purposes. Firstly, we'll create a new `Article`:
280
279
 
281
280
  ```ruby
282
- Post.create(body: 'Partial Layouts are cool!')
281
+ Article.create(body: 'Partial Layouts are cool!')
283
282
  ```
284
283
 
285
- In the `show` template, we'll render the `_post` partial wrapped in the `box` layout:
284
+ In the `show` template, we'll render the `_article` partial wrapped in the `box` layout:
286
285
 
287
- **posts/show.html.erb**
286
+ **articles/show.html.erb**
288
287
 
289
288
  ```erb
290
- <%= render partial: 'post', layout: 'box', locals: {post: @post} %>
289
+ <%= render partial: 'article', layout: 'box', locals: {article: @article} %>
291
290
  ```
292
291
 
293
- The `box` layout simply wraps the `_post` partial in a `div`:
292
+ The `box` layout simply wraps the `_article` partial in a `div`:
294
293
 
295
- **posts/_box.html.erb**
294
+ **articles/_box.html.erb**
296
295
 
297
296
  ```html+erb
298
297
  <div class='box'>
@@ -300,13 +299,13 @@ The `box` layout simply wraps the `_post` partial in a `div`:
300
299
  </div>
301
300
  ```
302
301
 
303
- The `_post` partial wraps the post's `body` in a `div` with the `id` of the post using the `div_for` helper:
302
+ The `_article` partial wraps the article's `body` in a `div` with the `id` of the article using the `div_for` helper:
304
303
 
305
- **posts/_post.html.erb**
304
+ **articles/_article.html.erb**
306
305
 
307
306
  ```html+erb
308
- <%= div_for(post) do %>
309
- <p><%= post.body %></p>
307
+ <%= div_for(article) do %>
308
+ <p><%= article.body %></p>
310
309
  <% end %>
311
310
  ```
312
311
 
@@ -314,22 +313,22 @@ this would output the following:
314
313
 
315
314
  ```html
316
315
  <div class='box'>
317
- <div id='post_1'>
316
+ <div id='article_1'>
318
317
  <p>Partial Layouts are cool!</p>
319
318
  </div>
320
319
  </div>
321
320
  ```
322
321
 
323
- Note that the partial layout has access to the local `post` variable that was passed into the `render` call. However, unlike application-wide layouts, partial layouts still have the underscore prefix.
322
+ Note that the partial layout has access to the local `article` variable that was passed into the `render` call. However, unlike application-wide layouts, partial layouts still have the underscore prefix.
324
323
 
325
- You can also render a block of code within a partial layout instead of calling `yield`. For example, if we didn't have the `_post` partial, we could do this instead:
324
+ You can also render a block of code within a partial layout instead of calling `yield`. For example, if we didn't have the `_article` partial, we could do this instead:
326
325
 
327
- **posts/show.html.erb**
326
+ **articles/show.html.erb**
328
327
 
329
328
  ```html+erb
330
- <% render(layout: 'box', locals: {post: @post}) do %>
331
- <%= div_for(post) do %>
332
- <p><%= post.body %></p>
329
+ <% render(layout: 'box', locals: {article: @article}) do %>
330
+ <%= div_for(article) do %>
331
+ <p><%= article.body %></p>
333
332
  <% end %>
334
333
  <% end %>
335
334
  ```
@@ -356,18 +355,18 @@ This module provides methods for generating container tags, such as `div`, for y
356
355
 
357
356
  Renders a container tag that relates to your Active Record Object.
358
357
 
359
- For example, given `@post` is the object of `Post` class, you can do:
358
+ For example, given `@article` is the object of `Article` class, you can do:
360
359
 
361
360
  ```html+erb
362
- <%= content_tag_for(:tr, @post) do %>
363
- <td><%= @post.title %></td>
361
+ <%= content_tag_for(:tr, @article) do %>
362
+ <td><%= @article.title %></td>
364
363
  <% end %>
365
364
  ```
366
365
 
367
366
  This will generate this HTML output:
368
367
 
369
368
  ```html
370
- <tr id="post_1234" class="post">
369
+ <tr id="article_1234" class="article">
371
370
  <td>Hello World!</td>
372
371
  </tr>
373
372
  ```
@@ -375,34 +374,34 @@ This will generate this HTML output:
375
374
  You can also supply HTML attributes as an additional option hash. For example:
376
375
 
377
376
  ```html+erb
378
- <%= content_tag_for(:tr, @post, class: "frontpage") do %>
379
- <td><%= @post.title %></td>
377
+ <%= content_tag_for(:tr, @article, class: "frontpage") do %>
378
+ <td><%= @article.title %></td>
380
379
  <% end %>
381
380
  ```
382
381
 
383
382
  Will generate this HTML output:
384
383
 
385
384
  ```html
386
- <tr id="post_1234" class="post frontpage">
385
+ <tr id="article_1234" class="article frontpage">
387
386
  <td>Hello World!</td>
388
387
  </tr>
389
388
  ```
390
389
 
391
- You can pass a collection of Active Record objects. This method will loop through your objects and create a container for each of them. For example, given `@posts` is an array of two `Post` objects:
390
+ You can pass a collection of Active Record objects. This method will loop through your objects and create a container for each of them. For example, given `@articles` is an array of two `Article` objects:
392
391
 
393
392
  ```html+erb
394
- <%= content_tag_for(:tr, @posts) do |post| %>
395
- <td><%= post.title %></td>
393
+ <%= content_tag_for(:tr, @articles) do |article| %>
394
+ <td><%= article.title %></td>
396
395
  <% end %>
397
396
  ```
398
397
 
399
398
  Will generate this HTML output:
400
399
 
401
400
  ```html
402
- <tr id="post_1234" class="post">
401
+ <tr id="article_1234" class="article">
403
402
  <td>Hello World!</td>
404
403
  </tr>
405
- <tr id="post_1235" class="post">
404
+ <tr id="article_1235" class="article">
406
405
  <td>Ruby on Rails Rocks!</td>
407
406
  </tr>
408
407
  ```
@@ -412,15 +411,15 @@ Will generate this HTML output:
412
411
  This is actually a convenient method which calls `content_tag_for` internally with `:div` as the tag name. You can pass either an Active Record object or a collection of objects. For example:
413
412
 
414
413
  ```html+erb
415
- <%= div_for(@post, class: "frontpage") do %>
416
- <td><%= @post.title %></td>
414
+ <%= div_for(@article, class: "frontpage") do %>
415
+ <td><%= @article.title %></td>
417
416
  <% end %>
418
417
  ```
419
418
 
420
419
  Will generate this HTML output:
421
420
 
422
421
  ```html
423
- <div id="post_1234" class="post frontpage">
422
+ <div id="article_1234" class="article frontpage">
424
423
  <td>Hello World!</td>
425
424
  </div>
426
425
  ```
@@ -436,39 +435,13 @@ config.action_controller.asset_host = "assets.example.com"
436
435
  image_tag("rails.png") # => <img src="http://assets.example.com/images/rails.png" alt="Rails" />
437
436
  ```
438
437
 
439
- #### register_javascript_expansion
440
-
441
- Register one or more JavaScript files to be included when symbol is passed to javascript_include_tag. This method is typically intended to be called from plugin initialization to register JavaScript files that the plugin installed in `vendor/assets/javascripts`.
442
-
443
- ```ruby
444
- ActionView::Helpers::AssetTagHelper.register_javascript_expansion monkey: ["head", "body", "tail"]
445
-
446
- javascript_include_tag :monkey # =>
447
- <script src="/assets/head.js"></script>
448
- <script src="/assets/body.js"></script>
449
- <script src="/assets/tail.js"></script>
450
- ```
451
-
452
- #### register_stylesheet_expansion
453
-
454
- Register one or more stylesheet files to be included when symbol is passed to `stylesheet_link_tag`. This method is typically intended to be called from plugin initialization to register stylesheet files that the plugin installed in `vendor/assets/stylesheets`.
455
-
456
- ```ruby
457
- ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion monkey: ["head", "body", "tail"]
458
-
459
- stylesheet_link_tag :monkey # =>
460
- <link href="/assets/head.css" media="screen" rel="stylesheet" />
461
- <link href="/assets/body.css" media="screen" rel="stylesheet" />
462
- <link href="/assets/tail.css" media="screen" rel="stylesheet" />
463
- ```
464
-
465
438
  #### auto_discovery_link_tag
466
439
 
467
440
  Returns a link tag that browsers and feed readers can use to auto-detect an RSS or Atom feed.
468
441
 
469
442
  ```ruby
470
- auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {title: "RSS Feed"}) # =>
471
- <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed" />
443
+ auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", { title: "RSS Feed" }) # =>
444
+ <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://www.example.com/feed.rss" />
472
445
  ```
473
446
 
474
447
  #### image_path
@@ -495,7 +468,7 @@ image_url("edit.png") # => http://www.example.com/assets/edit.png
495
468
 
496
469
  #### image_tag
497
470
 
498
- Returns an html image tag for the source. The source can be a full path or a file that exists in your `app/assets/images` directory.
471
+ Returns an HTML image tag for the source. The source can be a full path or a file that exists in your `app/assets/images` directory.
499
472
 
500
473
  ```ruby
501
474
  image_tag("icon.png") # => <img src="/assets/icon.png" alt="Icon" />
@@ -503,7 +476,7 @@ image_tag("icon.png") # => <img src="/assets/icon.png" alt="Icon" />
503
476
 
504
477
  #### javascript_include_tag
505
478
 
506
- Returns an html script tag for each of the sources provided. You can pass in the filename (`.js` extension is optional) of JavaScript files that exist in your `app/assets/javascripts` directory for inclusion into the current page or you can pass the full path relative to your document root.
479
+ Returns an HTML script tag for each of the sources provided. You can pass in the filename (`.js` extension is optional) of JavaScript files that exist in your `app/assets/javascripts` directory for inclusion into the current page or you can pass the full path relative to your document root.
507
480
 
508
481
  ```ruby
509
482
  javascript_include_tag "common" # => <script src="/assets/common.js"></script>
@@ -590,14 +563,14 @@ This helper makes building an Atom feed easy. Here's a full usage example:
590
563
  **config/routes.rb**
591
564
 
592
565
  ```ruby
593
- resources :posts
566
+ resources :articles
594
567
  ```
595
568
 
596
- **app/controllers/posts_controller.rb**
569
+ **app/controllers/articles_controller.rb**
597
570
 
598
571
  ```ruby
599
572
  def index
600
- @posts = Post.all
573
+ @articles = Article.all
601
574
 
602
575
  respond_to do |format|
603
576
  format.html
@@ -606,20 +579,20 @@ def index
606
579
  end
607
580
  ```
608
581
 
609
- **app/views/posts/index.atom.builder**
582
+ **app/views/articles/index.atom.builder**
610
583
 
611
584
  ```ruby
612
585
  atom_feed do |feed|
613
- feed.title("Posts Index")
614
- feed.updated((@posts.first.created_at))
586
+ feed.title("Articles Index")
587
+ feed.updated((@articles.first.created_at))
615
588
 
616
- @posts.each do |post|
617
- feed.entry(post) do |entry|
618
- entry.title(post.title)
619
- entry.content(post.body, type: 'html')
589
+ @articles.each do |article|
590
+ feed.entry(article) do |entry|
591
+ entry.title(article.title)
592
+ entry.content(article.body, type: 'html')
620
593
 
621
594
  entry.author do |author|
622
- author.name(post.author_name)
595
+ author.name(article.author_name)
623
596
  end
624
597
  end
625
598
  end
@@ -697,7 +670,7 @@ For example, let's say we have a standard application layout, but also a special
697
670
  </html>
698
671
  ```
699
672
 
700
- **app/views/posts/special.html.erb**
673
+ **app/views/articles/special.html.erb**
701
674
 
702
675
  ```html+erb
703
676
  <p>This is a special page.</p>
@@ -714,7 +687,7 @@ For example, let's say we have a standard application layout, but also a special
714
687
  Returns a set of select tags (one for year, month, and day) pre-selected for accessing a specified date-based attribute.
715
688
 
716
689
  ```ruby
717
- date_select("post", "published_on")
690
+ date_select("article", "published_on")
718
691
  ```
719
692
 
720
693
  #### datetime_select
@@ -722,7 +695,7 @@ date_select("post", "published_on")
722
695
  Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a specified datetime-based attribute.
723
696
 
724
697
  ```ruby
725
- datetime_select("post", "published_on")
698
+ datetime_select("article", "published_on")
726
699
  ```
727
700
 
728
701
  #### distance_of_time_in_words
@@ -736,7 +709,7 @@ distance_of_time_in_words(Time.now, Time.now + 15.seconds, include_seconds: true
736
709
 
737
710
  #### select_date
738
711
 
739
- Returns a set of html select-tags (one for year, month, and day) pre-selected with the `date` provided.
712
+ Returns a set of HTML select-tags (one for year, month, and day) pre-selected with the `date` provided.
740
713
 
741
714
  ```ruby
742
715
  # Generates a date select that defaults to the date provided (six days after today)
@@ -748,7 +721,7 @@ select_date()
748
721
 
749
722
  #### select_datetime
750
723
 
751
- Returns a set of html select-tags (one for year, month, day, hour, and minute) pre-selected with the `datetime` provided.
724
+ Returns a set of HTML select-tags (one for year, month, day, hour, and minute) pre-selected with the `datetime` provided.
752
725
 
753
726
  ```ruby
754
727
  # Generates a datetime select that defaults to the datetime provided (four days after today)
@@ -808,7 +781,7 @@ select_second(Time.now + 16.minutes)
808
781
 
809
782
  #### select_time
810
783
 
811
- Returns a set of html select-tags (one for hour and minute).
784
+ Returns a set of HTML select-tags (one for hour and minute).
812
785
 
813
786
  ```ruby
814
787
  # Generates a time select that defaults to the time provided
@@ -904,10 +877,10 @@ The params hash has a nested person value, which can therefore be accessed with
904
877
  Returns a checkbox tag tailored for accessing a specified attribute.
905
878
 
906
879
  ```ruby
907
- # Let's say that @post.validated? is 1:
908
- check_box("post", "validated")
909
- # => <input type="checkbox" id="post_validated" name="post[validated]" value="1" />
910
- # <input name="post[validated]" type="hidden" value="0" />
880
+ # Let's say that @article.validated? is 1:
881
+ check_box("article", "validated")
882
+ # => <input type="checkbox" id="article_validated" name="article[validated]" value="1" />
883
+ # <input name="article[validated]" type="hidden" value="0" />
911
884
  ```
912
885
 
913
886
  #### fields_for
@@ -939,7 +912,7 @@ file_field(:user, :avatar)
939
912
  Creates a form and a scope around a specific model object that is used as a base for questioning about values for the fields.
940
913
 
941
914
  ```html+erb
942
- <%= form_for @post do |f| %>
915
+ <%= form_for @article do |f| %>
943
916
  <%= f.label :title, 'Title' %>:
944
917
  <%= f.text_field :title %><br>
945
918
  <%= f.label :body, 'Body' %>:
@@ -961,8 +934,8 @@ hidden_field(:user, :token)
961
934
  Returns a label tag tailored for labelling an input field for a specified attribute.
962
935
 
963
936
  ```ruby
964
- label(:post, :title)
965
- # => <label for="post_title">Title</label>
937
+ label(:article, :title)
938
+ # => <label for="article_title">Title</label>
966
939
  ```
967
940
 
968
941
  #### password_field
@@ -979,11 +952,11 @@ password_field(:login, :pass)
979
952
  Returns a radio button tag for accessing a specified attribute.
980
953
 
981
954
  ```ruby
982
- # Let's say that @post.category returns "rails":
983
- radio_button("post", "category", "rails")
984
- radio_button("post", "category", "java")
985
- # => <input type="radio" id="post_category_rails" name="post[category]" value="rails" checked="checked" />
986
- # <input type="radio" id="post_category_java" name="post[category]" value="java" />
955
+ # Let's say that @article.category returns "rails":
956
+ radio_button("article", "category", "rails")
957
+ radio_button("article", "category", "java")
958
+ # => <input type="radio" id="article_category_rails" name="article[category]" value="rails" checked="checked" />
959
+ # <input type="radio" id="article_category_java" name="article[category]" value="java" />
987
960
  ```
988
961
 
989
962
  #### text_area
@@ -1002,8 +975,8 @@ text_area(:comment, :text, size: "20x30")
1002
975
  Returns an input tag of the "text" type tailored for accessing a specified attribute.
1003
976
 
1004
977
  ```ruby
1005
- text_field(:post, :title)
1006
- # => <input type="text" id="post_title" name="post[title]" value="#{@post.title}" />
978
+ text_field(:article, :title)
979
+ # => <input type="text" id="article_title" name="article[title]" value="#{@article.title}" />
1007
980
  ```
1008
981
 
1009
982
  #### email_field
@@ -1035,28 +1008,28 @@ Returns `select` and `option` tags for the collection of existing return values
1035
1008
  Example object structure for use with this method:
1036
1009
 
1037
1010
  ```ruby
1038
- class Post < ActiveRecord::Base
1011
+ class Article < ActiveRecord::Base
1039
1012
  belongs_to :author
1040
1013
  end
1041
1014
 
1042
1015
  class Author < ActiveRecord::Base
1043
- has_many :posts
1016
+ has_many :articles
1044
1017
  def name_with_initial
1045
1018
  "#{first_name.first}. #{last_name}"
1046
1019
  end
1047
1020
  end
1048
1021
  ```
1049
1022
 
1050
- Sample usage (selecting the associated Author for an instance of Post, `@post`):
1023
+ Sample usage (selecting the associated Author for an instance of Article, `@article`):
1051
1024
 
1052
1025
  ```ruby
1053
- collection_select(:post, :author_id, Author.all, :id, :name_with_initial, {prompt: true})
1026
+ collection_select(:article, :author_id, Author.all, :id, :name_with_initial, {prompt: true})
1054
1027
  ```
1055
1028
 
1056
- If `@post.author_id` is 1, this would return:
1029
+ If `@article.author_id` is 1, this would return:
1057
1030
 
1058
1031
  ```html
1059
- <select name="post[author_id]">
1032
+ <select name="article[author_id]">
1060
1033
  <option value="">Please select</option>
1061
1034
  <option value="1" selected="selected">D. Heinemeier Hansson</option>
1062
1035
  <option value="2">D. Thomas</option>
@@ -1071,33 +1044,33 @@ Returns `radio_button` tags for the collection of existing return values of `met
1071
1044
  Example object structure for use with this method:
1072
1045
 
1073
1046
  ```ruby
1074
- class Post < ActiveRecord::Base
1047
+ class Article < ActiveRecord::Base
1075
1048
  belongs_to :author
1076
1049
  end
1077
1050
 
1078
1051
  class Author < ActiveRecord::Base
1079
- has_many :posts
1052
+ has_many :articles
1080
1053
  def name_with_initial
1081
1054
  "#{first_name.first}. #{last_name}"
1082
1055
  end
1083
1056
  end
1084
1057
  ```
1085
1058
 
1086
- Sample usage (selecting the associated Author for an instance of Post, `@post`):
1059
+ Sample usage (selecting the associated Author for an instance of Article, `@article`):
1087
1060
 
1088
1061
  ```ruby
1089
- collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial)
1062
+ collection_radio_buttons(:article, :author_id, Author.all, :id, :name_with_initial)
1090
1063
  ```
1091
1064
 
1092
- If `@post.author_id` is 1, this would return:
1065
+ If `@article.author_id` is 1, this would return:
1093
1066
 
1094
1067
  ```html
1095
- <input id="post_author_id_1" name="post[author_id]" type="radio" value="1" checked="checked" />
1096
- <label for="post_author_id_1">D. Heinemeier Hansson</label>
1097
- <input id="post_author_id_2" name="post[author_id]" type="radio" value="2" />
1098
- <label for="post_author_id_2">D. Thomas</label>
1099
- <input id="post_author_id_3" name="post[author_id]" type="radio" value="3" />
1100
- <label for="post_author_id_3">M. Clark</label>
1068
+ <input id="article_author_id_1" name="article[author_id]" type="radio" value="1" checked="checked" />
1069
+ <label for="article_author_id_1">D. Heinemeier Hansson</label>
1070
+ <input id="article_author_id_2" name="article[author_id]" type="radio" value="2" />
1071
+ <label for="article_author_id_2">D. Thomas</label>
1072
+ <input id="article_author_id_3" name="article[author_id]" type="radio" value="3" />
1073
+ <label for="article_author_id_3">M. Clark</label>
1101
1074
  ```
1102
1075
 
1103
1076
  #### collection_check_boxes
@@ -1107,44 +1080,36 @@ Returns `check_box` tags for the collection of existing return values of `method
1107
1080
  Example object structure for use with this method:
1108
1081
 
1109
1082
  ```ruby
1110
- class Post < ActiveRecord::Base
1083
+ class Article < ActiveRecord::Base
1111
1084
  has_and_belongs_to_many :authors
1112
1085
  end
1113
1086
 
1114
1087
  class Author < ActiveRecord::Base
1115
- has_and_belongs_to_many :posts
1088
+ has_and_belongs_to_many :articles
1116
1089
  def name_with_initial
1117
1090
  "#{first_name.first}. #{last_name}"
1118
1091
  end
1119
1092
  end
1120
1093
  ```
1121
1094
 
1122
- Sample usage (selecting the associated Authors for an instance of Post, `@post`):
1095
+ Sample usage (selecting the associated Authors for an instance of Article, `@article`):
1123
1096
 
1124
1097
  ```ruby
1125
- collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial)
1098
+ collection_check_boxes(:article, :author_ids, Author.all, :id, :name_with_initial)
1126
1099
  ```
1127
1100
 
1128
- If `@post.author_ids` is [1], this would return:
1101
+ If `@article.author_ids` is [1], this would return:
1129
1102
 
1130
1103
  ```html
1131
- <input id="post_author_ids_1" name="post[author_ids][]" type="checkbox" value="1" checked="checked" />
1132
- <label for="post_author_ids_1">D. Heinemeier Hansson</label>
1133
- <input id="post_author_ids_2" name="post[author_ids][]" type="checkbox" value="2" />
1134
- <label for="post_author_ids_2">D. Thomas</label>
1135
- <input id="post_author_ids_3" name="post[author_ids][]" type="checkbox" value="3" />
1136
- <label for="post_author_ids_3">M. Clark</label>
1137
- <input name="post[author_ids][]" type="hidden" value="" />
1104
+ <input id="article_author_ids_1" name="article[author_ids][]" type="checkbox" value="1" checked="checked" />
1105
+ <label for="article_author_ids_1">D. Heinemeier Hansson</label>
1106
+ <input id="article_author_ids_2" name="article[author_ids][]" type="checkbox" value="2" />
1107
+ <label for="article_author_ids_2">D. Thomas</label>
1108
+ <input id="article_author_ids_3" name="article[author_ids][]" type="checkbox" value="3" />
1109
+ <label for="article_author_ids_3">M. Clark</label>
1110
+ <input name="article[author_ids][]" type="hidden" value="" />
1138
1111
  ```
1139
1112
 
1140
- #### country_options_for_select
1141
-
1142
- Returns a string of option tags for pretty much any country in the world.
1143
-
1144
- #### country_select
1145
-
1146
- Returns select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
1147
-
1148
1113
  #### option_groups_from_collection_for_select
1149
1114
 
1150
1115
  Returns a string of `option` tags, like `options_from_collection_for_select`, but groups them by `optgroup` tags based on the object relationships of the arguments.
@@ -1222,13 +1187,13 @@ Create a select tag and a series of contained option tags for the provided objec
1222
1187
  Example:
1223
1188
 
1224
1189
  ```ruby
1225
- select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: true})
1190
+ select("article", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {include_blank: true})
1226
1191
  ```
1227
1192
 
1228
- If `@post.person_id` is 1, this would become:
1193
+ If `@article.person_id` is 1, this would become:
1229
1194
 
1230
1195
  ```html
1231
- <select name="post[person_id]">
1196
+ <select name="article[person_id]">
1232
1197
  <option value=""></option>
1233
1198
  <option value="1" selected="selected">David</option>
1234
1199
  <option value="2">Sam</option>
@@ -1303,10 +1268,10 @@ file_field_tag 'attachment'
1303
1268
  Starts a form tag that points the action to an url configured with `url_for_options` just like `ActionController::Base#url_for`.
1304
1269
 
1305
1270
  ```html+erb
1306
- <%= form_tag '/posts' do %>
1271
+ <%= form_tag '/articles' do %>
1307
1272
  <div><%= submit_tag 'Save' %></div>
1308
1273
  <% end %>
1309
- # => <form action="/posts" method="post"><div><input type="submit" name="submit" value="Save" /></div></form>
1274
+ # => <form action="/articles" method="post"><div><input type="submit" name="submit" value="Save" /></div></form>
1310
1275
  ```
1311
1276
 
1312
1277
  #### hidden_field_tag
@@ -1368,8 +1333,8 @@ select_tag "people", "<option>David</option>"
1368
1333
  Creates a submit button with the text provided as the caption.
1369
1334
 
1370
1335
  ```ruby
1371
- submit_tag "Publish this post"
1372
- # => <input name="commit" type="submit" value="Publish this post" />
1336
+ submit_tag "Publish this article"
1337
+ # => <input name="commit" type="submit" value="Publish this article" />
1373
1338
  ```
1374
1339
 
1375
1340
  #### text_area_tag
@@ -1377,8 +1342,8 @@ submit_tag "Publish this post"
1377
1342
  Creates a text input area; use a textarea for longer text inputs such as blog posts or descriptions.
1378
1343
 
1379
1344
  ```ruby
1380
- text_area_tag 'post'
1381
- # => <textarea id="post" name="post"></textarea>
1345
+ text_area_tag 'article'
1346
+ # => <textarea id="article" name="article"></textarea>
1382
1347
  ```
1383
1348
 
1384
1349
  #### text_field_tag
@@ -1421,22 +1386,6 @@ date_field_tag "dob"
1421
1386
 
1422
1387
  Provides functionality for working with JavaScript in your views.
1423
1388
 
1424
- #### button_to_function
1425
-
1426
- Returns a button that'll trigger a JavaScript function using the onclick handler. Examples:
1427
-
1428
- ```ruby
1429
- button_to_function "Greeting", "alert('Hello world!')"
1430
- button_to_function "Delete", "if (confirm('Really?')) do_delete()"
1431
- button_to_function "Details" do |page|
1432
- page[:details].visual_effect :toggle_slide
1433
- end
1434
- ```
1435
-
1436
- #### define_javascript_functions
1437
-
1438
- Includes the Action Pack JavaScript libraries inside a single `script` tag.
1439
-
1440
1389
  #### escape_javascript
1441
1390
 
1442
1391
  Escape carrier returns and single and double quotes for JavaScript segments.
@@ -1457,15 +1406,6 @@ alert('All is good')
1457
1406
  </script>
1458
1407
  ```
1459
1408
 
1460
- #### link_to_function
1461
-
1462
- Returns a link that will trigger a JavaScript function using the onclick handler and return false after the fact.
1463
-
1464
- ```ruby
1465
- link_to_function "Greeting", "alert('Hello world!')"
1466
- # => <a onclick="alert('Hello world!'); return false;" href="#">Greeting</a>
1467
- ```
1468
-
1469
1409
  ### NumberHelper
1470
1410
 
1471
1411
  Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percentage, precision, positional notation, and file size.
@@ -1526,7 +1466,7 @@ The SanitizeHelper module provides a set of methods for scrubbing text of undesi
1526
1466
 
1527
1467
  #### sanitize
1528
1468
 
1529
- This sanitize helper will html encode all tags and strip all attributes that aren't specifically allowed.
1469
+ This sanitize helper will HTML encode all tags and strip all attributes that aren't specifically allowed.
1530
1470
 
1531
1471
  ```ruby
1532
1472
  sanitize @article.body
@@ -1550,7 +1490,7 @@ end
1550
1490
 
1551
1491
  Sanitizes a block of CSS code.
1552
1492
 
1553
- #### strip_links(html)
1493
+ #### strip_links(html)
1554
1494
  Strips all link tags from text leaving just the link text.
1555
1495
 
1556
1496
  ```ruby
@@ -1568,9 +1508,9 @@ strip_links('Blog: <a href="http://myblog.com/">Visit</a>.')
1568
1508
  # => Blog: Visit.
1569
1509
  ```
1570
1510
 
1571
- #### strip_tags(html)
1511
+ #### strip_tags(html)
1572
1512
 
1573
- Strips all HTML tags from the html, including comments.
1513
+ Strips all HTML tags from the html, including comments.
1574
1514
  This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner.
1575
1515
 
1576
1516
  ```ruby
@@ -1585,13 +1525,24 @@ strip_tags("<b>Bold</b> no more! <a href='more.html'>See more</a>")
1585
1525
 
1586
1526
  NB: The output may still contain unescaped '<', '>', '&' characters and confuse browsers.
1587
1527
 
1528
+ ### CsrfHelper
1529
+
1530
+ Returns meta tags "csrf-param" and "csrf-token" with the name of the cross-site
1531
+ request forgery protection parameter and token, respectively.
1532
+
1533
+ ```html
1534
+ <%= csrf_meta_tags %>
1535
+ ```
1536
+
1537
+ NOTE: Regular forms generate hidden fields so they do not use these tags. More
1538
+ details can be found in the [Rails Security Guide](security.html#cross-site-request-forgery-csrf).
1588
1539
 
1589
1540
  Localized Views
1590
1541
  ---------------
1591
1542
 
1592
1543
  Action View has the ability render different templates depending on the current locale.
1593
1544
 
1594
- For example, suppose you have a `PostsController` with a show action. By default, calling this action will render `app/views/posts/show.html.erb`. But if you set `I18n.locale = :de`, then `app/views/posts/show.de.html.erb` will be rendered instead. If the localized template isn't present, the undecorated version will be used. This means you're not required to provide localized views for all cases, but they will be preferred and used if available.
1545
+ For example, suppose you have a `ArticlesController` with a show action. By default, calling this action will render `app/views/articles/show.html.erb`. But if you set `I18n.locale = :de`, then `app/views/articles/show.de.html.erb` will be rendered instead. If the localized template isn't present, the undecorated version will be used. This means you're not required to provide localized views for all cases, but they will be preferred and used if available.
1595
1546
 
1596
1547
  You can use the same technique to localize the rescue files in your public directory. For example, setting `I18n.locale = :de` and creating `public/500.de.html` and `public/404.de.html` would allow you to have localized rescue pages.
1597
1548
 
@@ -1605,6 +1556,6 @@ def set_expert_locale
1605
1556
  end
1606
1557
  ```
1607
1558
 
1608
- Then you could create special views like `app/views/posts/show.expert.html.erb` that would only be displayed to expert users.
1559
+ Then you could create special views like `app/views/articles/show.expert.html.erb` that would only be displayed to expert users.
1609
1560
 
1610
1561
  You can read more about the Rails Internationalization (I18n) API [here](i18n.html).